Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

detect bad array shape

$
0
0

The following program has a bug.  Do you know if it is possible to have the compiler detect it?  I have tried the following options without success:

/Qtrapuv /Qinit:snan /Qinit:arrays /fpe:0   /check:all

program test_shape
implicit none

real,allocatable,dimension(:):: a, b
real c

allocate( a(5), b(2) )

b = 0.0
a = b   !!!

c = a(3)
print*, c  ! output: -4.3160208E+08  ???
stop
end program test_shape

 


Viewing all articles
Browse latest Browse all 3270


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>