Hello everybody. I found a reproducible problem which appears only for level 3 optimization.
I have an array, where N_lay is a defined constant integer somewhere in a module:
real :: layers_prop(0:N_lay+1)
Problem appears during execution of a following line:
if (any ((layers_prop(0:N_lay) - layers_prop(1:N_lay+1)) < 0.)) cycle
If optimization level is <= 2, it works perfectly (or any level of optimization if code is compiled with GCC). If optimization level is 3, it fails:
forrtl: severe (408): fort: (3): Subscript #1 of the array LAYERS_PROP has value -1 which is less than the lower bound of 0
I use ifort (IFORT) 18.0.2 20180210 running on x86_64 Linux computer
and compiling line is following: ifort -O3 -traceback -DD -debug -check bounds -check format -check uninit -autodouble -132 -warn all -fpp -no-wrap-margin -heap-arrays -mcmodel=medium -shared-intel -c
Could anybody comment on this?
Thank you in advance!
PS: I failed to produce a minimum working example: it works perfectly if I cut those lines out of the project (which is a big bunch of software). However, I'm ready to provide the code to Intel engineers (without further distribution, since it is a proprietary scientific software).