- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have been given the following code, and it chokes with ifort 12.0 optimizer:
program test
implicit none
integer*4 k , j , ibip
do k = 1 , 10
ibip = 0
do j = 0 , 15
if (btest(k,j)) then
ibip = ibip + 1
end if
end do
write(6,*) k , ibip
end do
end program test
ifort -o test test.f
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
ifort -O0 -o test test.f
1 1
2 1
3 2
4 1
5 2
6 2
7 3
8 1
9 2
10 2
What is happening here?
program test
implicit none
integer*4 k , j , ibip
do k = 1 , 10
ibip = 0
do j = 0 , 15
if (btest(k,j)) then
ibip = ibip + 1
end if
end do
write(6,*) k , ibip
end do
end program test
ifort -o test test.f
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
ifort -O0 -o test test.f
1 1
2 1
3 2
4 1
5 2
6 2
7 3
8 1
9 2
10 2
What is happening here?
Link Copied
9 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sure looks that way, doesn't it. Results are correct with -O1. I will report this to the developers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The same bug is seen with the 12.0.2.154 compilers (IA32 and X64) on Windows 7.
The bug is not seen with the 11.1.070 compilers on Windows 7.
The bug is not seen with the 11.1.070 compilers on Windows 7.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
same bug on Mac with O1 and O2 optimizations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I see all of that as well. Issue ID is DPD200169366. Inserting a WRITE after the IF restores correct results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As requested in the other thread relating to this bug, I was given this piece of code by a researcher at SISSA, Italy, claiming that I should always use the -fp-model precise flag with intel 12.0 (by the way, with that flag the program works: all arguments are integers, why enabling floating point precision should make the problem disappear?).
I did start a local thread with a CNR Democritos researcher about different results from a climatic model run using different versions of the ifort compiler (11.0 vs 12.0), talking about also a spurious segfault in -O3 on 12.0 on a misbehaved branch prediction, something like this:
[...]
flag = 0
namelist /mynamelist/ flag
read(infile, mynamelist) <- Flag is kept to zero value in the namelist
[...]
if (flag == 1) then
allocate(space(isamspace))
end if
[...]
if (flag == 1) then
if (space(1) == ival) then <- Segfaulting with -O3
[...]
end if
end if
[...]
Hope this helps.
I did start a local thread with a CNR Democritos researcher about different results from a climatic model run using different versions of the ifort compiler (11.0 vs 12.0), talking about also a spurious segfault in -O3 on 12.0 on a misbehaved branch prediction, something like this:
[...]
flag = 0
namelist /mynamelist/ flag
read(infile, mynamelist) <- Flag is kept to zero value in the namelist
[...]
if (flag == 1) then
allocate(space(isamspace))
end if
[...]
if (flag == 1) then
if (space(1) == ival) then <- Segfaulting with -O3
[...]
end if
end if
[...]
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
-fp-model strict turns off some optimizations which are probably at issue here.
I'm afraid we can't do anything with a paraphrase of a code segment. If you can provide a small but complete example that demonstrates the new problem, we'll be glad to take a look.
I'm afraid we can't do anything with a paraphrase of a code segment. If you can provide a small but complete example that demonstrates the new problem, we'll be glad to take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where exactly shoud be inserted WRITE after the IF?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Somewhere within the IF...ENDIF block -- after all, you are trying to trick the optimizer into giving up on optimizing the code in this vicinity, because you know that it will mess up if allowed to optimize. This is, after all, a stop-gap measure that will be abandoned after the optimizer bug is fixed.
Instead of an I/O statement, you can also try inserting a subroutine or function call, the called routine being located in a different compilation unit and IPO not active.
It is not possible to give a more precise location, since that would depend on knowing the optimization strategy in all its details, nor is it worth spending a lot of time over.
Instead of an I/O statement, you can also try inserting a subroutine or function call, the called routine being located in a different compilation unit and IPO not active.
It is not possible to give a more precise location, since that would depend on knowing the optimization strategy in all its details, nor is it worth spending a lot of time over.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem was corrected in Composer XE 2011 Update 6.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page