PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / whole_file_12.f90
blob150ac5f9d5db648bda2ac03d01996c82e391efd2
1 ! { dg-do compile }
2 ! { dg-options "-fwhole-file" }
4 ! Tests the fix PR40011 comment 17 in which the explicit interface was
5 ! being ignored and the missing argument was not correctly handled, which
6 ! led to an ICE.
8 ! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr
10 Implicit None
11 call sub(1,2)
12 call sub(1,2,3)
14 contains
16 subroutine sub(i,j,k)
17 Implicit None
18 Integer, Intent( In ) :: i
19 Integer, Intent( In ) :: j
20 Integer, Intent( In ), Optional :: k
21 intrinsic present
22 write(*,*)' 3 presence flag ',present(k)
23 write(*,*)' 1st arg ',i
24 write(*,*)' 2nd arg ',j
25 if (present(k)) then
26 write(*,*)' 3rd arg ',k
27 else
28 write(*,*)' 3rd arg is absent'
29 endif
30 return
31 end subroutine
33 end