weird behaviour of loop with new Compiler 11.0

weird behaviour of loop with new Compiler 11.0

Hi everyone,

we recognized a weird error with the new compiler.

We use Code which is older than me and worked allready with many different compilers.

I write into this Forum and not to the support, because I can't reproduce this error with a small example.

do i=2,nrp,1
if(abs(y(i)-y(i-1)).lt.genau_eps.and.
+ abs(z(i)-z(i-1)).lt.genau_eps) then
y(i-1)=y(i)
z(i-1)=z(i)
endseg(nseg)=i-1
nseg=nseg+1
startseg(nseg)=i
endseg(nseg)=nrp
endif
enddo

executes with the runtime error

"Subscript #1 of the array Y has value 0 which is less than the lower bound of 1"

Did any Compiler-Options change from Compiler 10->11 so the Compiler maybe tries to change loop behaviour.

This only happens when Compiling with -O2, -g works correctly.

If I add an write statement to control "i", the problem also doesn't occur.

Is there maybe a compiler-option to avoid this?

Thanks in advance

Hauke

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It looks like a possible optimization induced issue. The g option works because that implies O0. The WRITE of variable "I" likely breaks the optimization too.

It appears you may have also enabled at least check bounds or perhaps check all along with O2. It is not clear from the run-time error message alone if any statement re-ordering occurred that would lead to incorrect results.

Try removing the check option and just compile with O2. That should avoid the run-time check/error and permit inspecting the results of the application for correctness.

I will try constructing a test case from the code snippet provided and post an update later. Can you please post an update to provide the declared types for the various variables appearing in the loop. Thank you.

Quoting - rossow74@fsg

Hi everyone,

we recognized a weird error with the new compiler.

We use Code which is older than me and worked allready with many different compilers.

I write into this Forum and not to the support, because I can't reproduce this error with a small example.

do i=2,nrp,1
if(abs(y(i)-y(i-1)).lt.genau_eps.and.
+ abs(z(i)-z(i-1)).lt.genau_eps) then
y(i-1)=y(i)
z(i-1)=z(i)
endseg(nseg)=i-1
nseg=nseg+1
startseg(nseg)=i
endseg(nseg)=nrp
endif
enddo

executes with the runtime error

"Subscript #1 of the array Y has value 0 which is less than the lower bound of 1"

Did any Compiler-Options change from Compiler 10->11

This only happens when Compiling with -O2, -g works correctly.

If I add an write statement to control "i", the problem also doesn't occur.

Is there maybe a compiler-option to avoid this?

Thanks in advance

Hauke

For 32-bit ifort, the default changed from extended precision (ia32) to -mSSE -ftz. -O0 -g continues to default to extended precision. If you are depending on gradual underflow, for example, you might set it directly (-no-ftz) or indirectly (-fp-model precise). As is often mentioned when people ask for help, variable declarations and compiler options used are indispensable.

Thanks for your replies, but for me it does not seam reasonable to remove the check all Compiler Option.

We have about 1 Million lines of code, whcih is managed by a global make-system.

And frequently we have real errors which lead to the error quoted. These errors wouldn't also be shown anymore.

And the thing that is curious about this problem, that the code worked with the same options on the Compiler-Version 10 and before already on Version 9.

Login to leave a comment.