OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / whole_file_12.f90
1 ! { dg-do compile }
2 ! { dg-options "-fwhole-file" }
3 !
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.
7 !
8 ! Contributed by Dominique d'Humieres  <dominiq@lps.ens.fr
9 !
10           Implicit None 
11           call sub(1,2) 
12           call sub(1,2,3)
13  
14           contains
15
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
32
33           end