RISC-V: Refactor Dynamic LMUL codes
[official-gcc.git] / gcc / testsuite / gfortran.dg / noreturn-1.f90
blob3155cdf22aa53c282622bd81263d3edef11cb0e9
1 ! Check for various valid and erroneous "noreturn" cases.
2 ! { dg-do compile }
3 ! { dg-options "-O2" }
5 module barbar
6 !GCC$ ATTRIBUTES noreturn :: bar1
7 contains
8 subroutine bar1
9 end subroutine bar1 ! { dg-warning "'noreturn' function does return" "detect falling off end of noreturn" }
10 end module
12 subroutine foo1
13 !GCC$ ATTRIBUTES noreturn :: foo1
14 end subroutine foo1 ! { dg-warning "'noreturn' function does return" "detect falling off end of noreturn" }
16 subroutine foo2
17 !GCC$ ATTRIBUTES noreturn :: foo2
18 call exit(0)
19 end subroutine foo2 ! { dg-bogus "warning:" "this function should not get any warnings" }
21 subroutine foo3
22 end subroutine foo3 ! { dg-bogus "warning:" "this function should not get any warnings" }
24 subroutine foo4
25 !GCC$ ATTRIBUTES noreturn :: foo4
26 call foo2()
27 end subroutine foo4 ! { dg-bogus "warning:" "this function should not get any warnings" }
29 subroutine foo5
30 !GCC$ ATTRIBUTES noreturn :: foo5
31 return ! { dg-warning "'noreturn' function does return" "detect invalid return" }
32 end subroutine foo5
34 subroutine foo6
35 return
36 end subroutine foo6 ! { dg-bogus "warning:" "this function should not get any warnings" }
38 subroutine foo7
39 call foo6()
40 end subroutine foo7 ! { dg-bogus "warning:" "this function should not get any warnings" }
42 subroutine foo8
43 !GCC$ ATTRIBUTES noreturn :: foo8
44 call foo7()
45 end subroutine foo8 ! { dg-warning "'noreturn' function does return" "detect return from tail call" }
47 subroutine foo9
48 !GCC$ ATTRIBUTES noreturn :: foo9
49 interface
50 subroutine bar
51 !GCC$ ATTRIBUTES noreturn :: bar
52 end subroutine bar
53 end interface
54 call bar()
55 end subroutine foo9 ! { dg-bogus "warning:" "this function should not get any warnings" }
57 function ffo1()
58 implicit none
59 !GCC$ ATTRIBUTES noreturn :: ffo1
60 integer :: ffo1
61 ffo1 = 0
62 end function ffo1 ! { dg-warning "'noreturn' function does return" "detect falling off end of noreturn" }