* read.c (cons_worker): Detect and reject unexpected string argument.
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 5 May 2010 14:17:50 +0000 (14:17 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Wed, 5 May 2010 14:17:50 +0000 (14:17 +0000)
testsuite/
* gas/all/byte.s: New.
* gas/all/byte.l: New.
* gas/all/byte.d: New.
* gas/all/gas.exp: Add it.

gas/ChangeLog
gas/read.c
gas/testsuite/ChangeLog
gas/testsuite/gas/all/byte.d [new file with mode: 0644]
gas/testsuite/gas/all/byte.l [new file with mode: 0644]
gas/testsuite/gas/all/byte.s [new file with mode: 0644]
gas/testsuite/gas/all/gas.exp

index d8bfcd0478f5d0760986cc7cb9a077e8f0b35928..e8aefbfc80c28828ba9993b6e2597e9efae26332 100644 (file)
@@ -1,3 +1,7 @@
+2010-05-05  Julian Brown  <julian@codesourcery.com>
+
+       * read.c (cons_worker): Detect and reject unexpected string argument.
+
 2010-05-04  Nick Clifton  <nickc@redhat.com>
 
        * write.c (fixup_segment): Revert previous delta.
index 4afb190173e31d66abc56c79047e1f510c00f37e..32ac5e2c0f3ef5c13ff2859cde4ce800e70423a4 100644 (file)
@@ -3865,7 +3865,15 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long.  */
        parse_mri_cons (&exp, (unsigned int) nbytes);
       else
 #endif
-       TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
+        {
+         if (*input_line_pointer == '"')
+           {
+             as_bad (_("unexpected `\"' in expression"));
+             ignore_rest_of_line ();
+             return;
+           }
+         TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
+       }
 
       if (rva)
        {
index c9eae547f77afc95a1e9b0a7811868f0dc56d70b..bed67b51bc65b7554a7e411fb258277f18d9b96f 100644 (file)
@@ -1,3 +1,10 @@
+2010-05-05  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * gas/all/byte.s: New.
+       * gas/all/byte.l: New.
+       * gas/all/byte.d: New.
+       * gas/all/gas.exp: Add it.
+
 2010-04-29  Nathan Sidwell  <nathan@codesourcery.com>
 
        * gas/arm/weakdef-1.s: New.
diff --git a/gas/testsuite/gas/all/byte.d b/gas/testsuite/gas/all/byte.d
new file mode 100644 (file)
index 0000000..739b9ce
--- /dev/null
@@ -0,0 +1,2 @@
+#name: bad byte directive
+#error-output: byte.l
diff --git a/gas/testsuite/gas/all/byte.l b/gas/testsuite/gas/all/byte.l
new file mode 100644 (file)
index 0000000..a87bb71
--- /dev/null
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:1: Error: unexpected `"' in expression
+[^:]*:2: Error: unexpected `"' in expression
diff --git a/gas/testsuite/gas/all/byte.s b/gas/testsuite/gas/all/byte.s
new file mode 100644 (file)
index 0000000..8d60938
--- /dev/null
@@ -0,0 +1,2 @@
+        .byte " "
+        .byte "  "
index 80082367eb631f00ccf7aa325f04e4b43979fea3..8e0483e067ac12c820c9b665550edba41159f56b 100644 (file)
@@ -329,6 +329,8 @@ if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] && ![istarget "hppa*-
     run_dump_test relax
 }
 
+run_dump_test byte
+
 # .quad is 16 bytes on i960.
 if { ![istarget "i960-*-*"] } {
     run_dump_test quad