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