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

            Bug ID: 94106
           Summary: error on a function redeclaration with attribute
                    transaction_safe
           Product: gcc
           Version: 10.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: ---

Of the six declarations below each is accepted on its own.  The latter two
redeclarations are accepted as well, but the first redeclaration is rejected
with an error.  I can't find documentation of the attributes in the manual so
it's not entirely clear to me whether the error is a bug or whether its absence
on the other two redeclarations is a bug, or whether this works as intended,
but intuitively I would expect all three to accepted as happens with other
attributes.

$ cat z.c && gcc -Wall -Wextra -S -Wall z.c
                                   void f0 (void);
__attribute__ ((transaction_safe)) void f0 (void);       // (bogus?) error

                                     void f1 (void);
__attribute__ ((transaction_unsafe)) void f1 (void);     // accepted

                                       void f2 (void);
__attribute__ ((transaction_callable)) void f2 (void);   // accepted

z.c:2:41: error: conflicting types for ‘f0’
    2 | __attribute__ ((transaction_safe)) void f0 (void);       // (bogus?)
error
      |                                         ^~
z.c:1:41: note: previous declaration of ‘f0’ was here
    1 |                                    void f0 (void);
      |                                         ^~

Reply via email to