[Bug target/90524] New: attribute name and argument mixed up in an error message

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 17 19:18:00 GMT 2019


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

            Bug ID: 90524
           Summary: attribute name and argument mixed up in an error
                    message
           Product: gcc
           Version: 9.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 first message below is backwards: the name of the argument is 'target' and
the argument to it is "foobar":

$ cat x.c && gcc -O2 -S -Wall x.c
__attribute__ ((target ("foobar"))) void foo () { }

__attribute__ ((foobar ("target"))) void bar () { }

x.c:1:42: error: attribute ‘foobar’ argument ‘target’ is unknown
    1 | __attribute__ ((target ("foobar"))) void foo () { }
      |                                          ^~~
x.c:3:1: warning: ‘foobar’ attribute directive ignored [-Wattributes]
    3 | __attribute__ ((foobar ("target"))) void bar () { }
      | ^~~~~~~~~~~~~

Contrast that to Clang:

$ clang -S -Wall x.c
x.c:1:25: warning: unsupported 'foobar' in the 'target' attribute string;
      'target' attribute ignored [-Wignored-attributes]
__attribute__ ((target ("foobar"))) void foo () { }
                        ^
x.c:3:17: warning: unknown attribute 'foobar' ignored [-Wunknown-attributes]
__attribute__ ((foobar ("target"))) void bar () { }
                ^
2 warnings generated.


More information about the Gcc-bugs mailing list