From: Trevor Saunders Date: Mon, 8 Dec 2014 00:35:33 +0000 (+0000) Subject: don't ICE when section attribute is used on things in comdats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b0122457bc82d5ae39a9b32655713dd279224ed4;p=gcc.git don't ICE when section attribute is used on things in comdats 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa95bebe2b7..760f5fc3a0a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-12-07 Trevor Saunders + + * 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 PR target/50751 diff --git a/gcc/symtab.c b/gcc/symtab.c index 3eceb88340f..101bc25ac41 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -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 index 00000000000..c8262b8f2e9 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr63621.C @@ -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); +}