* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
[official-gcc.git] / gcc / testsuite / gcc.dg / noreturn-7.c
blob8ae5e2382241d9a6d438d4e6cb7ee2d1abc45078
1 /* PR optimization/13394 */
2 /* Origin: Carlo Wood <carlo@gcc.gnu.org> */
4 /* Verify that a bogus "function does return" warning is not issued
5 in presence of tail recursion within a noreturn function. */
7 /* { dg-do compile } */
8 /* { dg-options "-O2 -Wreturn-type -Wmissing-noreturn" } */
11 void f(void) __attribute__ ((__noreturn__));
12 void _exit(int status) __attribute__ ((__noreturn__));
14 int z = 0;
16 void g()
17 { /* { dg-warning "possible candidate" } */
18 if (++z > 10)
19 _exit(0);
20 g();
23 void f()
25 if (++z > 10)
26 _exit(0);
27 f();
28 } /* { dg-bogus "does return" } */
30 int h()
31 { /* { dg-warning "possible candidate" } */
32 if (++z > 10)
33 _exit(0);
34 return h();
35 } /* { dg-bogus "end of non-void function" } */
37 int k()
38 { /* { dg-warning "possible candidate" } */
39 if (++z > 10)
40 _exit(0);
41 k();
42 } /* { dg-warning "control reaches" } */