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

            Bug ID: 122180
           Summary: [16 regression] compilation failure with target
                    attribute on x86_64
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arkamar at gentoo dot org
  Target Milestone: ---

I have discovered a regression introduced in commit 73888cefe6da ("c: Add
target_version attribute support."). Minimal reproducer looks like this:

```
#pragma GCC target("avx")

static void s() __attribute__((target("avx")));
static void s() { }
void f() {
        s();
}
```

The compilation fails with following error message:

```
gentoo-0afd0b92 ~ # gcc -c test.c
test.c: In function 'f':
test.c:6:9: error: implicit declaration of function 's'
[-Wimplicit-function-declaration]
    6 |         s();
      |         ^
test.c:6:9: error: conflicting types for 's'; have 'int()'
test.c:4:13: note: previous definition of 's' with type 'void(void)'
    4 | static void s() { }
      |             ^
```

I discovered it when I tried to build rspamd-3.13.1 with most recent
gcc-16.0.0_p20251005 snapshot in gentoo. The reproducer was minimized with
cvise from original
https://github.com/rspamd/rspamd/blob/4e7545435b0a6e4ca2c45e04d58ac12e900545e6/contrib/libottery/aes_cryptobox.c#L91-L94.
As you can see, libottery sets the "aes" target, but I tried multiple different
targets and the results is always the same, so I left the "avx" there.

Reply via email to