Silverfrost Forums

Welcome to our forums

Inconsistent detection of uninitialised arrays

8 Mar 2021 3:31 (Edited: 8 Mar 2021 8:37) #27244

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.

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'.

8 Mar 2021 8:03 #27248

mecej4

Thank you for reporting this error. I have logged this for investigation.

31 Mar 2021 10:20 #27374

This has now been fixed for the next release of FN95.

Please login to reply.