Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28701 Discussions

Overly ambitious run-time check with "Check for Null Pointers and Allocatable Array References"

thomas_boehme
New Contributor II
431 Views
In the following example, I get a run-time exception "forrtl: sever (408): fort (7): Attempt to use pointer OUTP when it is not associated with a target" upon the call to the subroutine test. This happens when the run time check "Check for Null Pointers and Allocatable Array References" is turned on.

In my opinion, this is wrong as OUTP is actually an allocatable and not a pointer. Also the dummy argument is allocatable and intent (out). I believe that the call with the unallocated variable is legal (it works without the runtime check) and should not be detected as an error by the runtime checker.

This error is not limited to character allocatables but seems to occur for allocatable arrays as well. I also believe that this use should be legal even without intent (out) as long as the subroutine does not try to access the allocatable before it is actually allocated.

This issue occurs both with IVF 11.1.065 and IVF 2011.0.055

regards,
Thomas

[fortran]    program Console1
    implicit none
    character(:), allocatable :: outp
    call test( outp )
    write(*,*) outp

    contains

    subroutine test( chr )
    character(:), allocatable, intent(out) :: chr
    chr = 'abc'
    end subroutine

    end program Console1[/fortran]


0 Kudos
3 Replies
Steven_L_Intel1
Employee
431 Views
Thomas,

Thanks for bringing this to our attention. I have escalated this as issue DPD200161453. I was unable to reproduce a problem with "normal" allocatable arrays - remember that you have to use /assume:realloc_lhs to get the implicit allocation on assignment of non-character allocatables.
0 Kudos
thomas_boehme
New Contributor II
431 Views
Hi Steve,

thanks for escalating this issue.

As for "normal" allocatable arrays, it does happen in our code.However,I just tried it in the simple code andfailed to reproduce it. The allocatable arrays where it happens for useare fields in a base type that is extendend. The types and subroutinesare spread out across several modules, so it might be related to another issue. I will try to get a simple reproducer for this case.

regards,
Thomas
0 Kudos
Steven_L_Intel1
Employee
431 Views
This was fixed in 12.0 Update 1.
0 Kudos
Reply