diff options
author | Martin Sebor <msebor@redhat.com> | 2020-03-18 14:47:29 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-03-18 14:47:29 -0600 |
commit | 3512dc0108afbed3bece2e9fa1719fb3ce1d73d9 (patch) | |
tree | cda4737627e690c9602d88bf15d77ade17d4b108 /gcc/testsuite/gcc.dg | |
parent | 7a5fffa5ed0a8edfca772d43465d2c9b55bb23cc (diff) | |
download | gcc-3512dc0108afbed3bece2e9fa1719fb3ce1d73d9.zip gcc-3512dc0108afbed3bece2e9fa1719fb3ce1d73d9.tar.gz gcc-3512dc0108afbed3bece2e9fa1719fb3ce1d73d9.tar.bz2 |
PR ipa/92799 - ICE on a weakref function definition followed by a declaration
gcc/testsuite/ChangeLog:
PR ipa/92799
* gcc.dg/attr-weakref-5.c: New test.
gcc/ChangeLog:
PR ipa/92799
* cgraphunit.c (process_function_and_variable_attributes): Also
complain about weakref function definitions and drop all effects
of the attribute.
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/attr-weakref-5.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/attr-weakref-5.c b/gcc/testsuite/gcc.dg/attr-weakref-5.c new file mode 100644 index 0000000..e2f0406 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-weakref-5.c @@ -0,0 +1,31 @@ +/* PR middle-end/92799 - ICE on a weakref function definition followed + by a declaration + { dg-do compile } + { dg-options "-Wall" } */ + +static __attribute__ ((weakref ("bar"))) void f0 (void) { } // { dg-warning "'weakref' attribute ignored because function is defined" } + +extern void f0 (void); + +void* use_f0 (void) { return f0; } + + +static __attribute__ ((weakref ("bar"))) void f1 (void) { } // { dg-warning "'weakref' attribute ignored because function is defined" } + +static void f1 (void); + +void* use_f1 (void) { return f1; } + + +static __attribute__ ((weakref ("bar"))) void f2 (void); + +static void f2 (void) { } // { dg-error "redefinition" } + +void* use_f2 (void) { return f2; } + + +static __attribute__ ((weakref ("bar"))) void f3 (void); + +void f3 (void) { } // { dg-error "redefinition" } + +void* use_f3 (void) { return f3; } |