https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81585

            Bug ID: 81585
           Summary: fastcall/stdcall attribute conflict not detected on
                    distinct declarations of 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 i386 back-end makes an effort to detect mutually exclusive function
attribute combinations such as fastcall and stdcall but it missed those that
result from merging such attributes from distinct declarations.  Those then
lead to type errors later on.

The back-end also rejects these conflicting declaration with an error.  That
makes sense to me but it's inconsistent with how GCC treats other such
conflicts (they are typically diagnosed with -Wattributes, with the conflicting
attribute being dropped in favor of the original; i.e., the first one wins).

$ cat x.c && gcc -O2 -S -Wall -Wextra -Wpedantic -m32 x.c
void __attribute__ ((fastcall, stdcall)) f (void);

void __attribute__ ((fastcall)) g (void);

void __attribute__ ((stdcall)) g (void);
x.c:1:1: error: stdcall and fastcall attributes are not compatible
 void __attribute__ ((fastcall, stdcall)) f (void);
 ^~~~
x.c:5:32: error: conflicting types for ā€˜g’
 void __attribute__ ((stdcall)) g (void);
                                ^
x.c:3:33: note: previous declaration of ā€˜g’ was here
 void __attribute__ ((fastcall)) g (void);
                                 ^

Reply via email to