From: Jakub Jelinek Date: Fri, 30 Aug 2019 12:46:13 +0000 (+0200) Subject: backport: re PR c/90760 (ICE on attributes section and alias in set_section, at symta... X-Git-Tag: releases/gcc-7.5.0~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dbbeed4a74095923e6824efd863c59a1a4694fb;p=thirdparty%2Fgcc.git backport: re PR c/90760 (ICE on attributes section and alias in set_section, at symtab.c:1573) Backported from mainline 2019-06-12 Jakub Jelinek PR c/90760 * symtab.c (symtab_node::set_section): Allow being called on aliases as long as they aren't analyzed yet. * gcc.dg/pr90760.c: New test. From-SVN: r275159 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eef46307e2f7..f8a16fc2c99b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2019-06-12 Jakub Jelinek + + PR c/90760 + * symtab.c (symtab_node::set_section): Allow being called on aliases + as long as they aren't analyzed yet. + 2019-04-19 Jakub Jelinek PR middle-end/90139 diff --git a/gcc/symtab.c b/gcc/symtab.c index c18f1b251991..8009dc9e97fa 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1520,7 +1520,7 @@ symtab_node::set_section (symtab_node *n, void *s) void symtab_node::set_section (const char *section) { - gcc_assert (!this->alias); + gcc_assert (!this->alias || !this->analyzed); call_for_symbol_and_aliases (symtab_node::set_section, const_cast(section), true); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0444fe859cf9..dcb3634ead05 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2019-06-12 Jakub Jelinek + + PR c/90760 + * gcc.dg/pr90760.c: New test. + 2019-05-10 Jakub Jelinek PR pch/90326 diff --git a/gcc/testsuite/gcc.dg/pr90760.c b/gcc/testsuite/gcc.dg/pr90760.c new file mode 100644 index 000000000000..525a21a732ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr90760.c @@ -0,0 +1,8 @@ +/* PR c/90760 */ +/* { dg-do compile } */ +/* { dg-require-named-sections "" } */ + +void bar (void) {} +void foo (void) __attribute__ ((alias ("bar"))); /* { dg-error "section of alias 'foo' must match section of its target" } */ +void foo (void) __attribute__ ((section ("baz"))); +void qux (void) __attribute__ ((alias ("bar"), section ("baz"))); /* { dg-error "section of alias 'qux' must match section of its target" } */