[Bug c/81854] New: weak alias of an incompatible symbol accepted
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Aug 16 07:31:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81854
Bug ID: 81854
Summary: weak alias of an incompatible symbol accepted
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
GCC helpfully rejects function declarations that alias a variable but fails to
complain about similarly incorrect declarations that alias functions with an
incompatible type.
$ cat b.c && gcc -O2 -Wall -Wextra -Wpedantic b.c
const char* __attribute__ ((weak, alias ("foo")))
bar (void); // error (good)
int foo;
const char* __attribute__ ((weak, alias ("foobar")))
baz (void); // accepted (bad)
void foobar (int *p) { *p = 0; }
b.c:2:1: error: ‘bar’ alias in between function and variable is not supported
bar (void); // error (good)
^~~
b.c:4:5: warning: ‘foo’ aliased declaration
int foo;
^~~
More information about the Gcc-bugs
mailing list