| 1 |
/* Test typeof propagation of noreturn function attributes with -std=gnu11: |
| 2 |
these are part of the type of a function pointer with GNU typeof, but not |
| 3 |
with C23 typeof. */ |
| 4 |
/* { dg-do link } */ |
| 5 |
/* { dg-options "-std=gnu11 -O2" } */ |
| 6 |
|
| 7 |
_Noreturn void f (void); |
| 8 |
|
| 9 |
typeof (&f) volatile p; |
| 10 |
typeof (&p) volatile pp; |
| 11 |
|
| 12 |
void link_failure (void); |
| 13 |
|
| 14 |
void |
| 15 |
g (void) |
| 16 |
{ |
| 17 |
(*p) (); |
| 18 |
link_failure (); |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
h (void) |
| 23 |
{ |
| 24 |
(**pp) (); |
| 25 |
link_failure (); |
| 26 |
} |
| 27 |
|
| 28 |
volatile int flag; |
| 29 |
volatile int x; |
| 30 |
|
| 31 |
int |
| 32 |
main (void) |
| 33 |
{ |
| 34 |
if (flag) |
| 35 |
g (); |
| 36 |
if (flag) |
| 37 |
h (); |
| 38 |
return x; |
| 39 |
} |