From: Jakub Jelinek Date: Wed, 12 Jun 2019 07:14:08 +0000 (+0200) Subject: re PR c/90760 (ICE on attributes section and alias in set_section, at symtab.c:1573) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f3139680c36885f772828607e2e4a6a3df7ec4aa;p=gcc.git re PR c/90760 (ICE on attributes section and alias in set_section, at symtab.c:1573) 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: r272178 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba257665673..ea28e6c9f6c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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-11 Faraz Shahbazker * config/mips/mips.c (mips_final_postscan_insn): Modify call diff --git a/gcc/symtab.c b/gcc/symtab.c index 905ca05e578..b1589ea8a40 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1583,7 +1583,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 302ac15bbe9..27535710633 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-06-12 Jakub Jelinek + + PR c/90760 + * gcc.dg/pr90760.c: New test. + 2019-06-11 Faraz Shahbazker * gcc.target/mips/data-sym-pool.c: Update expected output. diff --git a/gcc/testsuite/gcc.dg/pr90760.c b/gcc/testsuite/gcc.dg/pr90760.c new file mode 100644 index 00000000000..525a21a732f --- /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" } */