wrong results for optimized compilation

wrong results for optimized compilation

Hello,

I have some trouble with Intels Fortran-Compiler
ifort Version 9.0 on our Linux/Itanium platform.

Below you will find a short test program and a
test data file to demonstrate the problem.

program test
do i = 1, 1
open(unit=11,file='test.dat',status='old')
nComp = 0
do
if(nComp == 4) exit
nComp = nComp + 1
enddo
do
read(11,'(A)',end=900)
write(*,*) 'before do', nComp
do j = 1, nComp
write(*,*) ' after do', nComp
enddo
enddo
900 continue
close(11)
enddo
end

test.dat
--------
line 1
line 2
line 3

If I compile and run the program using
ifort test.f
./a.out

I get the wrong output:
before do 4
before do 4
after do 1
before do 4
after do 2
after do 2
Please note, that "before do" and "after do" differs in the
value.

If I compile and run the program without optimization using
ifort -g test.f
./a.out

I get the correct output:
before do 4
after do 4
after do 4
after do 4
after do 4
before do 4
after do 4
after do 4
after do 4
after do 4
before do 4
after do 4
after do 4
after do 4
after do 4

Does someone knows the reason of the difference?

Thanks,
Dieter

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

Hi,

seems to be the same bug as soyrush posted on17.2.

This was reported to Premier Support.

Hans

Hi,thank you forthe hint.In the meantime we have installed the last release of thecompiler and now the results are correct for all possibleoptimization levels.Best regards,Dieter

Leave a Comment

Please sign in to add a comment. Not a member? Join today