]>
Commit | Line | Data |
---|---|---|
356fcc67 JJ |
1 | /* { dg-do compile } * |
2 | /* { dg-options "-O2 -fdump-tree-ssa -std=gnu11" } */ | |
3 | /* { dg-final { scan-tree-dump-times "__builtin_unreachable" 4 "ssa" } } */ | |
4 | ||
5 | void bar1 (void); | |
6 | void bar2 (void); | |
7 | void bar3 (void); | |
8 | void bar4 (void); | |
9 | ||
10 | _Noreturn void | |
11 | foo1 (int *p, int y) | |
12 | { | |
13 | bar1 (); | |
14 | *p = y; | |
15 | return; /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */ | |
16 | } /* { dg-warning "'noreturn' function does return" "" { target *-*-* } .-1 } */ | |
17 | ||
18 | _Noreturn void | |
19 | foo2 (int *p, int y) | |
20 | { | |
21 | bar2 (); | |
22 | *p = y; | |
23 | } /* { dg-warning "'noreturn' function does return" } */ | |
24 | ||
25 | _Noreturn void | |
26 | foo3 (int *p, int y) | |
27 | { | |
28 | if (y > 10) | |
29 | return; /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */ | |
30 | bar3 (); | |
31 | *p = y; | |
32 | return; /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */ | |
33 | } /* { dg-warning "'noreturn' function does return" } */ | |
34 | ||
35 | _Noreturn void | |
36 | foo4 (int *p, int y) | |
37 | { | |
38 | if (y > 10) | |
39 | return; /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */ | |
40 | bar4 (); | |
41 | *p = y; | |
42 | } /* { dg-warning "'noreturn' function does return" } */ |