Terminate register name when reporting bad register
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Aug 2012 17:01:46 +0000 (17:01 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Aug 2012 17:01:46 +0000 (17:01 +0000)
gas/

PR gas/14457
* config/tc-i386.c (i386_att_operand): Terminate register name
when reporting bad register.

gas/testsuite/

PR gas/14457
* gas/i386/i386.exp: Run reg-bad.

* gas/i386/reg-bad.l: New.
* gas/i386/reg-bad.s: Likewise.

gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/ChangeLog
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/reg-bad.l [new file with mode: 0644]
gas/testsuite/gas/i386/reg-bad.s [new file with mode: 0644]

index 055d7d839143e847c63d8cf5c6745679e6fef665..21d57db76ee937758a98ff667908e7aec3cfd4a0 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/14457
+       * config/tc-i386.c (i386_att_operand): Terminate register name
+       when reporting bad register.
+
 2012-08-14  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * config/tc-mmix.c (loc_asserts): New variable.
index 171749e08b99318c3612e6de294710b95a4e3127..61ca2c798039ecb60e21626dc2584e12aa0be4cb 100644 (file)
@@ -7782,6 +7782,9 @@ i386_att_operand (char *operand_string)
                    }
                  else if (*base_string == REGISTER_PREFIX)
                    {
+                     end_op = strchr (base_string, ',');
+                     if (end_op)
+                       *end_op = '\0';
                      as_bad (_("bad register name `%s'"), base_string);
                      return 0;
                    }
@@ -7823,6 +7826,9 @@ i386_att_operand (char *operand_string)
            }
          else if (*base_string == REGISTER_PREFIX)
            {
+             end_op = strchr (base_string, ',');
+             if (end_op)
+               *end_op = '\0';
              as_bad (_("bad register name `%s'"), base_string);
              return 0;
            }
index 237f9c34d093fc90dc57e522c19404d055701b8d..3303cd781c3fb62b5a25851389c1c284b5b9ad85 100644 (file)
@@ -1,3 +1,11 @@
+2012-08-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/14457
+       * gas/i386/i386.exp: Run reg-bad.
+
+       * gas/i386/reg-bad.l: New.
+       * gas/i386/reg-bad.s: Likewise.
+
 2012-08-14  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * gas/mmix/err-fb-2.s: New test.
index b6a71153a8c3bc9f4cc82e29c1b2ee3acaad4235..4f3ee4160c2f58f63d90770b87e5696de34e7b13 100644 (file)
@@ -285,6 +285,7 @@ if [expr [istarget "i*86-*-*"] || [istarget "x86_64-*-*"]] then {
     run_dump_test "intel-expr"
     run_dump_test "string-ok"
     run_list_test "string-bad" ""
+    run_list_test "reg-bad" ""
     run_list_test "space1" "-al"
     run_dump_test rept
     if [is_elf_format] then {
diff --git a/gas/testsuite/gas/i386/reg-bad.l b/gas/testsuite/gas/i386/reg-bad.l
new file mode 100644 (file)
index 0000000..654a7f1
--- /dev/null
@@ -0,0 +1,5 @@
+.*: Assembler messages:
+.*:2: Error: bad register name `%xxx'
+.*:3: Error: bad register name `%xxx'
+.*:4: Error: bad register name `%xxxxxxxxx'
+.*:5: Error: bad register name `%xxxxxxxxx'
diff --git a/gas/testsuite/gas/i386/reg-bad.s b/gas/testsuite/gas/i386/reg-bad.s
new file mode 100644 (file)
index 0000000..e8454d6
--- /dev/null
@@ -0,0 +1,5 @@
+       .text
+        lea (%xxx,%esi,1),%esi
+        lea (%esi,%xxx,1),%esi
+        lea (%xxxxxxxxx,%esi,1),%esi
+        lea (%esi,%xxxxxxxxx,1),%esi