[Bug c/94196] New: Multiple issues with attributes
momchil.velikov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 16 15:59:11 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94196
Bug ID: 94196
Summary: Multiple issues with attributes
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: momchil.velikov at gmail dot com
Target Milestone: ---
Created attachment 48046
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48046&action=edit
reproducer/examples
Taking as an example the noreturn attribute.
It is documented as a function attribute.
Yet it is accepted as a type attribute, e.g. in
typedef void (*T2)(void) __attribute__((noreturn));
T2 g2;
void __attribute__((noreturn)) f2(void) {
g2();
}
or with some declarations, e.g.:
typedef void T1(void);
T1 g1a __attribute__((noreturn));
void __attribute__((noreturn)) f1a(void) {
g1a();
}
T1 *g1b __attribute__((noreturn));
void __attribute__((noreturn)) f1b(void) {
g1b();
}
but only sometimes (only with a function pointer types?):
- it is not accepted with function types, e.g.:
typedef void T3(void) __attribute__((noreturn));
T3 g3;
void __attribute__((noreturn)) f3(void) {
g3();
}
- or with pointer to function pointer types, e.g.
typedef void (**T4)(void) __attribute__((noreturn));
T4 g4;
void __attribute__((noreturn)) f4(void) {
(*g4)();
}
- or with array of function pointers, e.g.:
typedef void (*T5[4])(void) __attribute__((noreturn));
T5 g5;
void __attribute__((noreturn)) f5(int i) {
g5[i]();
}
- etc
cf. https://gcc.godbolt.org/z/jUnGER
More information about the Gcc-bugs
mailing list