re PR c++/27451 (ICE with invalid asm statement)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 22 May 2006 16:49:33 +0000 (16:49 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 22 May 2006 16:49:33 +0000 (16:49 +0000)
PR c++/27451
* stmt.c (expand_asm_operands): Skip asm statement with erroneous
clobbers.

* g++.dg/ext/asm9.C: New test.

From-SVN: r113985

gcc/ChangeLog
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/asm9.C [new file with mode: 0644]

index e1e61a5e2f16e3a0d0666156eab4dd9794482983..5ae866d0c9d62725509c91e1272e526ae2316e86 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27451
+       * stmt.c (expand_asm_operands): Skip asm statement with erroneous
+       clobbers.
+
 2006-05-22  Richard Sandiford  <richard@codesourcery.com>
 
        PR rtl-optimization/25514
index be3e876f589b6cad79f03b152973157e2b5204b4..193745314ad62c48226535a4cc80e3025143093f 100644 (file)
@@ -693,7 +693,11 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
   CLEAR_HARD_REG_SET (clobbered_regs);
   for (tail = clobbers; tail; tail = TREE_CHAIN (tail))
     {
-      const char *regname = TREE_STRING_POINTER (TREE_VALUE (tail));
+      const char *regname;
+
+      if (TREE_VALUE (tail) == error_mark_node)
+       return;
+      regname = TREE_STRING_POINTER (TREE_VALUE (tail));
 
       i = decode_reg_name (regname);
       if (i >= 0 || i == -4)
index c7a4eb2c8b9b025919c3d5f115f052dafd44279d..89b9a02fa89f8e1142f68940ab899c9232d2da4e 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27451
+       * g++.dg/ext/asm9.C: New test.
+
 2006-05-22  Richard Sandiford  <richard@codesourcery.com>
 
        PR rtl-optimization/25514
diff --git a/gcc/testsuite/g++.dg/ext/asm9.C b/gcc/testsuite/g++.dg/ext/asm9.C
new file mode 100644 (file)
index 0000000..9daa01b
--- /dev/null
@@ -0,0 +1,7 @@
+// PR 27451
+// { dg-do compile }
+
+void foo()
+{
+  asm("" ::: X); // { dg-error "before" }
+}