https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81545
Bug ID: 81545
Summary: attributes longcall and shortcall silently accepted on
the same function
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
The longcall and shortcall attributes are mutually exclusive and only one
should be accepted on any one declaration. GCC accepts both attributes, both
on the same declaration and on distinct declarations of the same function. The
first one is silly and relatively unlikely to occur in practice, but the second
one can come up when two declarations of a function in the same translation
unit are far removed from one another. To help catch coding mistakes GCC
should detect both of these cases and either reject them with an error or issue
-Wattributes.
$ cat t.c && gcc -O2 -S -Wall -Wextra -Wpedantic t.c
void __attribute__ ((longcall)) f (void);
void __attribute__ ((shortcall)) f (void);
void __attribute__ ((longcall, shortcall)) g (void);
$