Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Bug in ifort 10.1

kaoru_iwano
Beginner
606 Views
I found the following bug in compiling by ifort 10.1.
-O3 gives a wrong answer.

I hope that a bug fix will be done as soon as possible.

K. Iwano

***
implicit real*8 (a-h,o-z)
c
parameter(nn0=4,nz0=4)
parameter(n=1,nb=n*2,nbm=nb-1,num=2**nb-1)
c
common /jg/ jg4(-nn0-1:nn0+1,-nz0-1:nz0+1)
c
open(60,file='test.out')
c
write(60,*) 'block_1sites'
write(60,*) 'num, nbm=',num,nbm
c
jg4=0
c
do i=0,num
do ib=0,nbm,2
write(60,*) i, ib, ishft(i,-ib), iand(ishft(i,-ib),1)
enddo
enddo
c
stop
end

0 Kudos
3 Replies
Steven_L_Intel1
Employee
606 Views
Please be more specific - when I try this with a current 10.1, I get the same result from -O3 as I do from lower levels.

Which specific ifort do you have? Please show the command line you use, adding -V to display the version, then show running the program with the good and bad results.
0 Kudos
kaoru_iwano
Beginner
606 Views
Thank you so much for your concern.
Below I show the requested results, with the replacement
of the file output with the standard output. As you will see
easily, the latter is correct.

[***@*** ~]$ ifort -O3 -V test.f
Intel Fortran Compiler for applications running on Intel 64, Version 10.1 Build 20080112 Package ID: l_fc_p_10.1.012
Copyright (C) 1985-2007 Intel Corporation. All rights reserved.

Intel Fortran 10.1-2041
test.f(13): (col. 7) remark: LOOP WAS VECTORIZED.
GNU ld version 2.15.92.0.2 20040927
[***@*** ~]$ ./a.out
block_1sites
num, nbm= 3 1
0 0 0 0
1 0 0 0
2 0 0 0
3 0 0 0

[***@*** ~]$ ifort -O0 -V test.f
Intel Fortran Compiler for applications running on Intel 64, Version 10.1 Build 20080112 Package ID: l_fc_p_10.1.012
Copyright (C) 1985-2007 Intel Corporation. All rights reserved.

Intel Fortran 10.1-2041
GNU ld version 2.15.92.0.2 20040927
[***@*** ~]$ ./a.out
block_1sites
num, nbm= 3 1
0 0 0 0
1 0 1 1
2 0 2 0
3 0 3 1

0 Kudos
Steven_L_Intel1
Employee
606 Views
Thanks - I can reproduce this now. It requires that the compiler do vectorization on the loop. What I find very strange, and you obviously saw this too, is that removing the assignment to jg4 prevents vectorization and therefore the bug does not appear, even though jg4 is not used elsewhere in the program. I can reproduce this on IA-32 if I use -xW or higher and it doesn't need -O3 there.

I have escalated this to development to be fixed, but the priority will be lower because you did not file a support request with Intel Premier Support. If you want to do that, please add a reference to "T84154-CP".
0 Kudos
Reply