| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fstrub=relaxed" } */ |
| 3 |
/* { dg-require-effective-target strub } */ |
| 4 |
|
| 5 |
/* This is strub-ptrfn2.c without -Wpedantic. |
| 6 |
|
| 7 |
Even C doesn't report the (not-quite-)compatible conversions without it. */ |
| 8 |
|
| 9 |
extern int __attribute__ ((strub ("callable"))) bac (void); |
| 10 |
extern int __attribute__ ((strub ("disabled"))) bad (void); |
| 11 |
extern int __attribute__ ((strub ("internal"))) bar (void); |
| 12 |
extern int __attribute__ ((strub ("at-calls"))) bal (void); |
| 13 |
|
| 14 |
void __attribute__ ((strub)) |
| 15 |
bap (void) |
| 16 |
{ |
| 17 |
int __attribute__ ((strub ("disabled"))) (*d_p) (void) = bad; |
| 18 |
int __attribute__ ((strub ("callable"))) (*c_p) (void) = bac; |
| 19 |
int __attribute__ ((strub ("at-calls"))) (*a_p) (void) = bal; |
| 20 |
|
| 21 |
d_p = bac; |
| 22 |
c_p = bad; |
| 23 |
c_p = bar; |
| 24 |
c_p = bal; /* { dg-message "incompatible|invalid conversion" } */ |
| 25 |
a_p = bac; /* { dg-message "incompatible|invalid conversion" } */ |
| 26 |
} |
| 27 |
|
| 28 |
void __attribute__ ((strub)) |
| 29 |
baP (void) |
| 30 |
{ |
| 31 |
typedef int __attribute__ ((strub ("disabled"))) d_fn_t (void); |
| 32 |
typedef int __attribute__ ((strub ("callable"))) c_fn_t (void); |
| 33 |
typedef int __attribute__ ((strub ("at-calls"))) a_fn_t (void); |
| 34 |
|
| 35 |
d_fn_t *d_p = bad; |
| 36 |
c_fn_t *c_p = bac; |
| 37 |
a_fn_t *a_p = bal; |
| 38 |
|
| 39 |
d_p = bac; |
| 40 |
c_p = bad; |
| 41 |
c_p = bar; |
| 42 |
c_p = bal; /* { dg-message "incompatible|invalid conversion" } */ |
| 43 |
a_p = bac; /* { dg-message "incompatible|invalid conversion" } */ |
| 44 |
} |