summaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-10-12 12:51:17 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2001-10-12 12:51:17 +0200
commit8554d9a464c544fbe1f2cf7df84b33dd8ab79347 (patch)
treea51f1faf4476c94046f181727d55f03fb99cb9b1 /gcc/final.c
parente60505a59dad6aa8c17c43411e4998b209ddcd64 (diff)
downloadgcc-8554d9a464c544fbe1f2cf7df84b33dd8ab79347.tar.gz
final.c (output_asm_insn): Make sure assembly dialects are terminated, not nested.
* final.c (output_asm_insn): Make sure assembly dialects are terminated, not nested. Output `|' and `}' characters if they don't appear inside assembly dialect selection. * config/i386/i386.md (rep_movdi_rex64, rep_movsi, rep_movsi_rex64, rep_movqi, rep_movqi_rex64, rep_stosdi_rex64, rep_stossi, rep_stossi_rex64, rep_stosqi, rep_stosqi_rex64, strsetsi_1, strsetsi_rex_1): Add {} braces. * testsuite/gcc.dg/20011009-1.c: New test. From-SVN: r46227
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/gcc/final.c b/gcc/final.c
index 5884382b239..5d2d8d9ae69 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -3313,6 +3313,9 @@ output_asm_insn (template, operands)
{
const char *p;
int c;
+#ifdef ASSEMBLER_DIALECT
+ int dialect = 0;
+#endif
/* An insn may return a null string template
in a case where no assembler code is needed. */
@@ -3347,6 +3350,11 @@ output_asm_insn (template, operands)
{
int i;
+ if (dialect)
+ output_operand_lossage ("nested assembly dialect alternatives");
+ else
+ dialect = 1;
+
/* If we want the first dialect, do nothing. Otherwise, skip
DIALECT_NUMBER of strings ending with '|'. */
for (i = 0; i < dialect_number; i++)
@@ -3358,16 +3366,35 @@ output_asm_insn (template, operands)
if (*p == '|')
p++;
}
+
+ if (*p == '\0')
+ output_operand_lossage ("unterminated assembly dialect alternative");
}
break;
case '|':
- /* Skip to close brace. */
- while (*p && *p++ != '}')
- ;
+ if (dialect)
+ {
+ /* Skip to close brace. */
+ do
+ {
+ if (*p == '\0')
+ {
+ output_operand_lossage ("unterminated assembly dialect alternative");
+ break;
+ }
+ }
+ while (*p++ != '}');
+ dialect = 0;
+ }
+ else
+ putc (c, asm_out_file);
break;
case '}':
+ if (! dialect)
+ putc (c, asm_out_file);
+ dialect = 0;
break;
#endif