From 244e9313a8cb4fd2247a6a2b76d61ee73febb3b6 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 5 May 2010 14:17:48 +0000 Subject: [PATCH] * read.c (cons_worker): Detect and reject unexpected string argument. testsuite/ * gas/all/byte.s: New. * gas/all/byte.l: New. * gas/all/byte.d: New. * gas/all/gas.exp: Add it. --- gas/ChangeLog | 4 ++++ gas/read.c | 10 +++++++++- gas/testsuite/ChangeLog | 7 +++++++ gas/testsuite/gas/all/byte.d | 2 ++ gas/testsuite/gas/all/byte.l | 3 +++ gas/testsuite/gas/all/byte.s | 2 ++ gas/testsuite/gas/all/gas.exp | 2 ++ 7 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/all/byte.d create mode 100644 gas/testsuite/gas/all/byte.l create mode 100644 gas/testsuite/gas/all/byte.s diff --git a/gas/ChangeLog b/gas/ChangeLog index d8bfcd047..e8aefbfc8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2010-05-05 Julian Brown + + * read.c (cons_worker): Detect and reject unexpected string argument. + 2010-05-04 Nick Clifton * write.c (fixup_segment): Revert previous delta. diff --git a/gas/read.c b/gas/read.c index 4afb19017..32ac5e2c0 100644 --- a/gas/read.c +++ b/gas/read.c @@ -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) { diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index c9eae547f..bed67b51b 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2010-05-05 Nathan Sidwell + + * 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 * 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 index 000000000..739b9cead --- /dev/null +++ b/gas/testsuite/gas/all/byte.d @@ -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 index 000000000..a87bb7156 --- /dev/null +++ b/gas/testsuite/gas/all/byte.l @@ -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 index 000000000..8d6093884 --- /dev/null +++ b/gas/testsuite/gas/all/byte.s @@ -0,0 +1,2 @@ + .byte " " + .byte " " diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp index 80082367e..8e0483e06 100644 --- a/gas/testsuite/gas/all/gas.exp +++ b/gas/testsuite/gas/all/gas.exp @@ -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 -- 2.11.4.GIT