From: Jakub Jelinek Date: Fri, 28 Jun 2019 22:10:04 +0000 (+0200) Subject: backport: re PR c/90760 (ICE on attributes section and alias in set_section, at symta... X-Git-Tag: releases/gcc-9.2.0~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03b70afb515142cac65c579de7bec81906f79992;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: r272800 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 912d1cf7641a..31803992367a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-06-29 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-06-28 Jeff Law Backport from mainline diff --git a/gcc/symtab.c b/gcc/symtab.c index d648d288e401..29f6cdc46674 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1553,7 +1553,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 44d3afaaf2d6..f4d47bca67c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-06-29 Jakub Jelinek + + Backported from mainline + 2019-06-12 Jakub Jelinek + + PR c/90760 + * gcc.dg/pr90760.c: New test. + 2019-06-21 Jeff Law Backport fom mainline 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" } */