2018-04-30 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / noreturn-1.c
blobae7ee42fabcba5ceb4fdeca800b3ae938eb520a3
1 /* { dg-do compile } *
2 /* { dg-options "-O2 -fdump-tree-ssa -std=gnu11" } */
3 /* { dg-final { scan-tree-dump-times "__builtin_unreachable" 4 "ssa" } } */
5 void bar1 (void);
6 void bar2 (void);
7 void bar3 (void);
8 void bar4 (void);
10 _Noreturn void
11 foo1 (int *p, int y)
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 } */
18 _Noreturn void
19 foo2 (int *p, int y)
21 bar2 ();
22 *p = y;
23 } /* { dg-warning "'noreturn' function does return" } */
25 _Noreturn void
26 foo3 (int *p, int y)
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" } */
35 _Noreturn void
36 foo4 (int *p, int y)
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" } */