re PR c++/28343 (ICE with invalid asm specifier for struct member)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 14 Jul 2006 09:43:23 +0000 (09:43 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 14 Jul 2006 09:43:23 +0000 (09:43 +0000)
PR c++/28343
* decl.c (cp_finish_decl): Check asmspec_tree for error_mark_node.
* decl2.c (grokfield): Likewise.

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

From-SVN: r115436

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/asmspec1.C [new file with mode: 0644]

index de1f4f117a7d3e62b0ffda45617debe233738919..d8b8652f913a544c67fae9a43f071d7117089957 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-14  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28343
+       * decl.c (cp_finish_decl): Check asmspec_tree for error_mark_node.
+       * decl2.c (grokfield): Likewise.
+
 2006-07-12  Geoffrey Keating  <geoffk@apple.com>
 
        * decl2.c (determine_visibility): Don't change visibility of
index 1d5be58e09f401457279a75b7d39d80bee7c36b7..b74a1a9bac60127e847ce48492843e63c75404a0 100644 (file)
@@ -5056,7 +5056,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
   /* If a name was specified, get the string.  */
   if (global_scope_p (current_binding_level))
     asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree);
-  if (asmspec_tree)
+  if (asmspec_tree && asmspec_tree != error_mark_node)
     asmspec = TREE_STRING_POINTER (asmspec_tree);
 
   if (current_class_type
index 3a78c40c22364acd2358edff62aabe8bbc187968..11c4901cb3ad6fce6221fdcc4245756498fc43de 100644 (file)
@@ -837,7 +837,7 @@ grokfield (const cp_declarator *declarator,
       return void_type_node;
     }
 
-  if (asmspec_tree)
+  if (asmspec_tree && asmspec_tree != error_mark_node)
     asmspec = TREE_STRING_POINTER (asmspec_tree);
 
   if (init)
index 8b711994d3d23628bde3f208fbec4a45e7c6f243..fa86c8121cace8859f28268a26f9fe65a5168b7e 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-14  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28343
+       * g++.dg/ext/asmspec1.C: New test.
+
 2006-07-13  Janis Johnson  <janis187@us.ibm.com>
 
        * lib/gcc-dg.exp (tool_load): Wrapper to support shouldfail tests.
diff --git a/gcc/testsuite/g++.dg/ext/asmspec1.C b/gcc/testsuite/g++.dg/ext/asmspec1.C
new file mode 100644 (file)
index 0000000..3df2483
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/28343
+// { dg-do compile }
+
+struct A
+{
+  int i __asm__(int);         // { dg-error "before" }
+  static int j __asm__(int);  // { dg-error "before" }
+};