]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c/90760 (ICE on attributes section and alias in set_section, at symta...
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 12:46:13 +0000 (14:46 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 12:46:13 +0000 (14:46 +0200)
Backported from mainline
2019-06-12  Jakub Jelinek  <jakub@redhat.com>

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

gcc/ChangeLog
gcc/symtab.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr90760.c [new file with mode: 0644]

index eef46307e2f72c25d3ec9df2777ddb81f50e8c32..f8a16fc2c99b021b72ebb936d1179edd64a61564 100644 (file)
@@ -1,6 +1,12 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-06-12  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <jakub@redhat.com>
 
        PR middle-end/90139
index c18f1b25199153b0563e59abee13bfe991a21398..8009dc9e97fadd0998548a03169a9a70f080d14c 100644 (file)
@@ -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<char *>(section), true);
 }
index 0444fe859cf9b2954d2a6196c52141280922625d..dcb3634ead0507998fbe1d6a86954a9362b59b9f 100644 (file)
@@ -1,6 +1,11 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-06-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/90760
+       * gcc.dg/pr90760.c: New test.
+
        2019-05-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR pch/90326
diff --git a/gcc/testsuite/gcc.dg/pr90760.c b/gcc/testsuite/gcc.dg/pr90760.c
new file mode 100644 (file)
index 0000000..525a21a
--- /dev/null
@@ -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" } */