This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/81854] New: weak alias of an incompatible symbol accepted
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Aug 2017 22:23:08 +0000
- Subject: [Bug c/81854] New: weak alias of an incompatible symbol accepted
- Auto-submitted: auto-generated
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;
^~~