don't ICE when section attribute is used on things in comdats
authorTrevor Saunders <tsaunders@mozilla.com>
Mon, 8 Dec 2014 00:35:33 +0000 (00:35 +0000)
committerTrevor Saunders <tbsaunde@gcc.gnu.org>
Mon, 8 Dec 2014 00:35:33 +0000 (00:35 +0000)
gcc/

PR ipa/63621
* symtab.c (symtab_node::verify): Check for section attribute before
asserting something isn't in a section and a comdat group.

From-SVN: r218476

gcc/ChangeLog
gcc/symtab.c
gcc/testsuite/g++.dg/ipa/pr63621.C [new file with mode: 0644]

index fa95bebe2b7e8dbd5b45797a92de18fe837194e7..760f5fc3a0a723530867bf7246f1704c042ccb19 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-07  Trevor Saunders  <tsaunders@mozilla.com>
+
+       * symtab.c (symtab_node::verify): Check for section attribute before
+       asserting something isn't in a section and a comdat group.
+
 2014-12-07  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/50751
index 3eceb88340f504a9aeefe3d9ad372e31a6c588a2..101bc25ac410325bdfa7e81b47d5799e2a0dfa6e 100644 (file)
@@ -1102,7 +1102,8 @@ symtab_node::verify_base (void)
       error_found = true;
     }
   if (get_section () && get_comdat_group ()
-      && !implicit_section)
+      && !implicit_section
+      && !lookup_attribute ("section", DECL_ATTRIBUTES (decl)))
     {
       error ("Both section and comdat group is set");
       error_found = true;
diff --git a/gcc/testsuite/g++.dg/ipa/pr63621.C b/gcc/testsuite/g++.dg/ipa/pr63621.C
new file mode 100644 (file)
index 0000000..c8262b8
--- /dev/null
@@ -0,0 +1,29 @@
+// { dg-do compile }
+ class A
+{
+       public:
+               int __attribute__((section("a"))) f1(bool);
+               int f2(void *);
+               int f3(bool);
+};
+
+inline int A::f1(bool b)
+{
+       static  int c;
+       if (c)
+               ;
+       return 0;
+}
+
+inline int A::f3(bool b)
+{
+       static __attribute__((section(""))) int c;
+       if (c)
+               ;
+       return 0;
+}
+
+int A::f2(void *c)
+{
+       return f1(c) + f3(c);
+}