From edd1967d0c957ab48836fe0cc0128d012c6b6c6c Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 6 Feb 2002 17:38:40 -0800 Subject: [PATCH] re PR c/5609 (ICE on named operands in inline assembler) PR c/5609 * stmt.c (resolve_operand_name_1): Take more care with mixed named and unnamed operands. * gcc.dg/asm-4.c: Add case with an unnamed operand in the middle. From-SVN: r49560 --- gcc/ChangeLog | 6 ++++++ gcc/stmt.c | 20 ++++++++++++++------ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/asm-4.c | 1 + 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b413d62b1c..7560a0b671a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-02-06 Richard Henderson + + PR c/5609 + * stmt.c (resolve_operand_name_1): Take more care with mixed + named and unnamed operands. + 2002-02-06 Janis Johnson Jan Hubicka diff --git a/gcc/stmt.c b/gcc/stmt.c index 99f910a9d21..17b4d0b1972 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -2149,15 +2149,23 @@ resolve_operand_name_1 (p, outputs, inputs) /* Resolve the name to a number. */ for (op = 0, t = outputs; t ; t = TREE_CHAIN (t), op++) { - const char *c = IDENTIFIER_POINTER (TREE_PURPOSE (TREE_PURPOSE (t))); - if (strncmp (c, p + 1, len) == 0 && c[len] == '\0') - goto found; + tree id = TREE_PURPOSE (TREE_PURPOSE (t)); + if (id) + { + const char *c = IDENTIFIER_POINTER (id); + if (strncmp (c, p + 1, len) == 0 && c[len] == '\0') + goto found; + } } for (t = inputs; t ; t = TREE_CHAIN (t), op++) { - const char *c = IDENTIFIER_POINTER (TREE_PURPOSE (TREE_PURPOSE (t))); - if (strncmp (c, p + 1, len) == 0 && c[len] == '\0') - goto found; + tree id = TREE_PURPOSE (TREE_PURPOSE (t)); + if (id) + { + const char *c = IDENTIFIER_POINTER (id); + if (strncmp (c, p + 1, len) == 0 && c[len] == '\0') + goto found; + } } *q = '\0'; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 759f06c62b9..a32e28e5b09 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-02-06 Richard Henderson + + * gcc.dg/asm-4.c: Add case with an unnamed operand in the middle. + 2002-02-06 Janis Johnson * gcc.dg/20020206-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/asm-4.c b/gcc/testsuite/gcc.dg/asm-4.c index 862888ad345..00675982aa2 100644 --- a/gcc/testsuite/gcc.dg/asm-4.c +++ b/gcc/testsuite/gcc.dg/asm-4.c @@ -8,6 +8,7 @@ int main() asm volatile ("test0 X%0Y%[arg]Z" : [arg] "=g" (x)); asm volatile ("test1 X%[out]Y%[in]Z" : [out] "=g" (y) : [in] "0"(y)); asm volatile ("test2 X%a0Y%a[arg]Z" : : [arg] "p" (&z)); + asm volatile ("test3 %[in]" : [inout] "=g"(x) : "[inout]" (x), [in] "g" (y)); } /* ??? Someone explain why the back reference dosn't work. */ -- 2.30.2