re PR c/5609 (ICE on named operands in inline assembler)
authorRichard Henderson <rth@redhat.com>
Thu, 7 Feb 2002 01:38:40 +0000 (17:38 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 7 Feb 2002 01:38:40 +0000 (17:38 -0800)
        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
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/asm-4.c

index 6b413d62b1ccd6c61022c305f68d283879b44967..7560a0b671a38a0e14104080126e0ed6d9c07fdc 100644 (file)
@@ -1,3 +1,9 @@
+2002-02-06  Richard Henderson  <rth@redhat.com>
+
+       PR c/5609
+       * stmt.c (resolve_operand_name_1): Take more care with mixed
+       named and unnamed operands.
+
 2002-02-06  Janis Johnson  <janis187@us.ibm.com>
            Jan Hubicka  <jh@suse.cz>
 
index 99f910a9d2194a956b4e1a470d6624b7109c4edd..17b4d0b197267b4d7e15e3682a366ef41f3ce3b7 100644 (file)
@@ -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';
index 759f06c62b9d5181d56cde12da50ae08a87746ad..a32e28e5b099e179d2b987ed0ea5a96be7fdefce 100644 (file)
@@ -1,3 +1,7 @@
+2002-02-06  Richard Henderson  <rth@redhat.com>
+
+       * gcc.dg/asm-4.c: Add case with an unnamed operand in the middle.
+
 2002-02-06  Janis Johnson  <janis187@us.ibm.com>
 
        * gcc.dg/20020206-1.c: New test.
index 862888ad345aa7abc8cff6c299fd8bc5a560d15a..00675982aa2247b7e16fb8aded1131fac45a9233 100644 (file)
@@ -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.  */