https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68637
Bug ID: 68637 Summary: Wrong -Wattributes on array of function pointers Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com Target Milestone: --- hjl@gnu-6 gcc]$ cat y.c typedef void (*func) (int, int) __attribute__ ((regparm (2))); extern func foo[10]; extern void (*bar[10]) (int, int) __attribute__ ((regparm (2))); void xxx (int i) { foo[i] (1, 2); bar[i] (1, 2); } [hjl@gnu-6 gcc]$ gcc -S -m32 -O2 y.c y.c:3:1: warning: ‘regparm’ attribute only applies to function types [-Wattributes] extern void (*bar[10]) (int, int) __attribute__ ((regparm (2))); ^ [hjl@gnu-6 gcc]$ /export/build/gnu/llvm-clang/build-x86_64-linux/bin/clang -S -m32 -O2 y.c [hjl@gnu-6 gcc]$