| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Tests the fix PR40011 comment 17 in which the explicit interface was |
| 4 |
! being ignored and the missing argument was not correctly handled, which |
| 5 |
! led to an ICE. |
| 6 |
! |
| 7 |
! Contributed by Dominique d'Humieres <[email protected] |
| 8 |
! |
| 9 |
Implicit None |
| 10 |
call sub(1,2) |
| 11 |
call sub(1,2,3) |
| 12 |
|
| 13 |
contains |
| 14 |
|
| 15 |
subroutine sub(i,j,k) |
| 16 |
Implicit None |
| 17 |
Integer, Intent( In ) :: i |
| 18 |
Integer, Intent( In ) :: j |
| 19 |
Integer, Intent( In ), Optional :: k |
| 20 |
intrinsic present |
| 21 |
write(*,*)' 3 presence flag ',present(k) |
| 22 |
write(*,*)' 1st arg ',i |
| 23 |
write(*,*)' 2nd arg ',j |
| 24 |
if (present(k)) then |
| 25 |
write(*,*)' 3rd arg ',k |
| 26 |
else |
| 27 |
write(*,*)' 3rd arg is absent' |
| 28 |
endif |
| 29 |
return |
| 30 |
end subroutine |
| 31 |
|
| 32 |
end |