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

SIZE on unallocated array does not trap with /check:pointer

2 Replies
Devorah_H_Intel
Moderator
1,365 Views

@tobias-loew could you please provide a test case of what exactly is not working with /check:pointer, also a compiler version used. 

We tested internally and it seems to be working just fine, an error message is issued at runtime:

Size of the unallocated allocatable array:           0
forrtl: severe (408): fort: (8): Attempt to fetch from allocatable variable ALLOCARRAY when it is not allocated

 

 

0 Kudos
tobias-loew
New Contributor I
1,327 Views

Hi @Devorah_H_Intel ,

 

when I run the following code, compiled with

/nologo /debug:full /Od /warn:all /module:"x64\Debug\\" /object:"x64\Debug\\" /traceback /check:all /libs:dll /threads /dbglibs /c

and linked with

/OUT:"x64\Debug\Console1.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Debug\Console1.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\**bleep**\source\repos\Console1\Console1\x64\Debug\Console1.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\Users\**bleep**\source\repos\Console1\Console1\x64\Debug\Console1.lib"

on "Intel® Fortran Compiler 2025.1"

then it does not trap.

    program Console1
    implicit none

    integer, allocatable :: arr(:)
    integer :: size_of_array

    ! Intentionally call SIZE() on an unallocated array to trigger an error
    size_of_array = size(arr)

    end program Console1
    

I attached the project.

Reply