]> 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, 28 Jun 2019 22:10:04 +0000 (00:10 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 28 Jun 2019 22:10:04 +0000 (00:10 +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: r272800

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

index 912d1cf7641a0f17905105c0a0df8b796df84879..31803992367a89bc3142a653d5bb9876ccc5fe58 100644 (file)
@@ -1,3 +1,12 @@
+2019-06-29  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-06-28  Jeff Law  <law@redhat.com>
 
        Backport from mainline
index d648d288e401c72aeb3ec91cd082d15c239ec344..29f6cdc46674255e3ef0490157ef46f9d56551e8 100644 (file)
@@ -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<char *>(section), true);
 }
index 44d3afaaf2d60b1fa4c95710fcaf99c42bec9aae..f4d47bca67c488b38ea092b6531f497c2ea57280 100644 (file)
@@ -1,3 +1,11 @@
+2019-06-29  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-06-21  Jeff Law  <law@redhat.com>
 
        Backport fom mainline
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" } */