- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
An run-time error is given by ifort version 15.0.0 using the "-check all" option when passing a null pointer to an optional argument.
Without the the "-check all" option, the result seems correct.
Gfortran is ok
! This code passes a null pointer to an optional argument of a procedure.
! Athough the code seems to works fine, it leads to the following error when compiled with "-check all":
! forrtl: severe (408): fort: (7): Attempt to use pointer PTR when it is not associated with a target
! Gfortran compiles and run fine.
! Tested with ifort version 15.0.0
Program Main
implicit none
integer ,target :: i = 0
integer ,pointer :: Ptr
write(*,*) "Calling with arg"
call Proc( i )
write(*,*) "Calling without arg"
call Proc()
Ptr => i
write(*,*) "Calling with Ptr => i"
call Proc(Ptr)
Ptr => null() ! This should be ok but but causes an error when compiled using the "-check all" option
write(*,*) "Calling with Ptr => null"
call Proc(Ptr)
contains
Subroutine Proc( Arg )
integer ,optional ,intent(inout) :: Arg
if (Present(Arg) ) then
write(*,*) " Present argument"
Arg = Arg + 1
else
write(*,*) " Absent argument"
end if
End Subroutine
End Program
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - escalated as issue DPD200369832.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect this to be fixed in the 16.0 release.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page