1 /* PR middle-end/pr42363, extended from the test for PR middle-end/37913. */
2 /* { dg-do compile } */
3 /* { dg-options "-g" } */
5 void foo (void) __attribute__ ((noreturn
));
7 static int __attribute__ ((noreturn
))
20 int fooz (void) __attribute__ ((noreturn
));
22 static int __attribute__ ((noreturn
))
25 return fooz (); /* { dg-warning "noreturn" } */
49 /* This might be regarded as pure and folded, rather than inlined,
50 but because it's pure evil it's diagnosed and the noreturn attribute
51 is dropped. The const attribute is dropped as well because it's
52 mutually exclusive with pure. */
53 static int __attribute__ ((pure
, const, noreturn
))
55 /* { dg-warning "ignoring attribute .const." "const" { target *-*-* } .-1 } */
56 /* { dg-warning "ignoring attribute .noreturn." "noreturn" { target *-*-* } .-2 } */
58 /* The noreturn attribute is ignored so verify there is no warning
59 for returning from the function:
60 { dg-bogus "does return" } */
63 static int __attribute__ ((pure
, const))
64 bark (void) { /* { dg-warning "ignoring attribute .const." } */
72 i
= j
= bark () + bark ();
81 i
= j
= barf () + barf ();