1 /* PR middle-end/pr42363, extended from the test for PR middle-end/37913. */ 2 /* { dg-do compile } */ 3 /* { dg-options "-g" } */ 4 5 void foo (void) __attribute__ ((noreturn)); 6 7 static int __attribute__ ((noreturn)) bar(void)8bar (void) 9 { 10 foo (); 11 } 12 13 int baz(void)14baz (void) 15 { 16 int i = bar (); 17 return i + 1; 18 } 19 20 int fooz (void) __attribute__ ((noreturn)); 21 22 static int __attribute__ ((noreturn)) bart(void)23bart (void) 24 { 25 return fooz (); /* { dg-warning "noreturn" } */ 26 } 27 bazr(void)28int bazr (void) 29 { 30 int i = bart (); 31 return i + 1; 32 } 33 34 static inline int bard(void)35bard (void) 36 { 37 return fooz (); 38 } 39 bizr(void)40int bizr (void) 41 { 42 int i, j; 43 44 i = j = bard (); 45 46 return i + 1; 47 } 48 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)) barf(void)54barf (void) { 55 /* { dg-warning "ignoring attribute .const." "const" { target *-*-* } .-1 } */ 56 /* { dg-warning "ignoring attribute .noreturn." "noreturn" { target *-*-* } .-2 } */ 57 } /* { dg-warning "does return" } */ 58 59 static int __attribute__ ((pure, const)) bark(void)60bark (void) { /* { dg-warning "ignoring attribute .const." } */ 61 barf (); 62 } 63 buzr(void)64int buzr (void) 65 { 66 int i, j; 67 68 i = j = bark () + bark (); 69 70 return i + 1; 71 } 72 buzt(void)73int buzt (void) 74 { 75 int i, j; 76 77 i = j = barf () + barf (); 78 79 return i + 1; 80 } 81 bust(void)82void bust (void) 83 { 84 while (barf ()) 85 ; 86 } 87