Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gfortran.dg / altreturn_3.f90
blob999ada87a0758c6287af9a961dddb7be9458856d
1 ! { dg-do run }
2 ! Tests the fix for PR30236, which was due to alternate returns
3 ! in generic interfaces causing a segfault. They now work
4 ! correctly.
6 ! Contributed by Brooks Moses <brooks@gcc.gnu.org>
8 module arswitch
9 implicit none
10 interface gen
11 module procedure with
12 module procedure without
13 end interface
14 contains
15 subroutine with(i,*)
16 integer i
17 if (i>0) then
18 i = -1
19 return 1
20 else
21 i = -2
22 return
23 end if
24 end subroutine
25 subroutine without()
26 return
27 end subroutine
28 end module
30 program test
31 use arswitch
32 implicit none
33 integer :: i = 0
34 call gen (i, *10)
35 if (i /= -2) call abort ()
36 i = 2
37 call gen (i, *20)
38 10 continue
39 call abort()
40 20 continue
41 if (i /= -1) call abort ()
42 end
43 ! { dg-final { cleanup-modules "arswitch" } }