This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/81854] New: weak alias of an incompatible symbol accepted


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;
     ^~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]