Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4995 Discussions

Fortran - Insifficient memory

Vladimir_F_1
Beginner
859 Views

I am getting critical errors with weight 100 for allocating an array with zero size.

example:

[fortran]

allocatable a(:)
allocate(a(0))
end

[/fortran]

[plain]

P1: Critical: Insufficient memory
zeroarray.f90(2): error #12138: size of allocated memory (0 bytes) is smaller than required to hold the object "A[]" (4 bytes)
Problem P1.1: Insufficient memory: New
zeroarray.f90(2): error #12138: size of allocated memory (0 bytes) is smaller than required to hold the object "A[]" (4 bytes)
X1: Allocation site: /home/lada/f/testy/intel/zeroarray.f90(2): Function MAIN_
Code snippet:
1 allocatable a(:)
>2 allocate(a(0))
3 end
4

Stack (1 of 1 instance(s))
>Unknown!MAIN_ - /home/lada/f/testy/intel/zeroarray.f90:2[/plain]

I believe this usage of allocatable arrays is completely legitimate.

0 Kudos
3 Replies
Peter_W_Intel
Employee
859 Views
I cannot reproduce this issue. My example: peter.f90 program peter allocatable a(:) allocate(a(0)) print*, "Hello world!" end # ifort -g peter.f90 -o peter # inspxe-cl -collect mi3 -- ./peter Used suppression file(s): Hello world! 1 new problem(s) found 1 Memory not deallocated problem(s) detected # inspxe-cl -report problems Used suppression file(s): P1: Warning: Memory not deallocated Problem P1.3: Memory not deallocated: Not fixed /home/peter/problem_report/peter.f90(3): Warning X3: Allocation site: Function peter: Module /home/peter/problem_report/peter This is only a warning message, can be ignored - when Fortran program exits, it will call "garbage collector" to discard collected a. Not sure if we used same compiler version, and inspector XE version. # ifort --version ifort (IFORT) 13.0.1 20121010 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. # inspxe-cl -version Intel(R) Inspector XE 2013 Update 3 (build 259694) Command Line tool Copyright (C) 2009-2012 Intel Corporation. All rights reserved.
0 Kudos
Mark_D_Intel
Employee
859 Views
This issue is with static analysis, not dynamic analysis To reproduce the problem, compile with (windows syntax): ifort -Qdiag-enable:sc-full peter.f90 This is likely a problem with the static analysis code. Zero-sized array allocations are legal in Fortran. (Although access to any element of the array will result in a runtime error)
0 Kudos
Peter_W_Intel
Employee
859 Views
Thanks Mark. I also can reproduce this problem on Linux by using SSA. # ifort -g -diag-enable sv3 peter.f90 ifort: command line remark #10010: option '-diag-enable sv3' is deprecated and will be removed in a future release. See '-help deprecated' ifort: remark #10336: Static analysis complete; results available in "./r000sc/r000sc.inspxe" # inspxe-cl -report problem -r r000sc Used suppression file(s): ... P1: Critical: Insufficient memory peter.f90(3): error #12138: size of allocated memory (0 bytes) is smaller than required to hold the object "A[]" (4 bytes) Problem P1.1: Insufficient memory: New peter.f90(3): error #12138: size of allocated memory (0 bytes) is smaller than required to hold the object "A[]" (4 bytes) X1: Allocation site: /home/peter/problem_report/peter.f90(3): Function MAIN_ I have reported this problem to engineering team. I will update on this thread, if any progress. Temporarily please ignore such problem report, sorry for any inconvenience caused.
0 Kudos
Reply