mecej4
Joined: 31 Oct 2006 Posts: 1949 Location: USA
|
Posted: Mon Mar 08, 2021 4:31 am Post subject: Inconsistent detection of uninitialised arrays |
|
|
Programs containing uninitialised real arrays with more than 256 elements can have these arrays unexpectedly become initialised to 0.0 and the bug can go undetected, even when /undef has been used, when building and running 64-bit programs.
The following code illustrates the problem. All the runs were with FTN95 8.70, and with /64. Compiling for 32-bits does not give rise to any of these problems.
| Code: |
program BAADF00D
implicit none
real , dimension(257) :: conc
print *,conc(1) ! Printing uninitialised variable!!
stop
end program BAADF00D |
When I ran this program after compiling with /64, or with /64 /opt, it printed various values including 0.00000.
When I used /64 /debug, I found in SDBG64 that the array was filled with -0.00132704, which has an IEEE-32-bit representation of Z'BAADF00D'. Running the EXE prints out various values.
When I used /64 /undef or /64 /checkmate, I found in SDBG64 that the array was filled with 0.0, and the program printed 0.00000.
I then changed the value of the dimension of the array CONC to 256, and normal behaviour was recovered. Using /64 /debug fills the array with 0 and the program prints 0.00000. Using /64 /check causes the output of ????????????????, and SDBG64 displays the values of the array elements as UNDEFINED. Using /64 /undef causes the program to abort with a pop-up window, as desired, and the array element values are shown as 'UNDEFINED'.
Last edited by mecej4 on Mon Mar 08, 2021 9:37 am; edited 1 time in total |
|