- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following reproducer is a simplified version of the one recently posted by "bflynt" "Pointer Optimization Bug ?" . I can confirm that this is an optimizer bug, and has nothing to do with MPI, which might be what one may conclude from his post.
If the three units are combined into a single source file, the bug goes away, so I keep the pieces separate.
The type definition module, typ.f90:
If the three units are combined into a single source file, the bug goes away, so I keep the pieces separate.
The type definition module, typ.f90:
[fortran]module typedefThe subroutine where the optimizer bug manifests itself, build.f90:
type schedule
integer :: nproc_send
integer :: nproc_recv
integer :: nbuff_send
integer :: nbuff_recv
integer , pointer :: iproc_send(:)
integer , pointer :: iproc_recv(:)
integer , pointer :: ipntr_recv(:)
end type schedule
end module typedef
[/fortran]
[fortran]module buildand a short main program, prg.f90:
contains
subroutine build_sub(sch)
use typedef
implicit none
type(schedule) :: sch
sch%nproc_recv = 1
allocate(sch%ipntr_recv(2))
sch%ipntr_recv(sch%nproc_recv+1) = 0
sch%nproc_send = 0
sch%nproc_recv = 0
sch%nbuff_send = 0
sch%nbuff_recv = 0
write(6,*) 'In sub build, sch%nproc_recv : ',sch%nproc_recv
return
end subroutine build_sub
end module build
[/fortran]
[fortran]program test1Compiling on Linux or Windows using the 11.1.070 or 12.0.2, 12.0.3 compilers with no optimization and running gives the correct output:
use typedef
use build
implicit none
type(schedule) :: gpt
call build_sub(gpt)
write(*,*)'In main prog, gpt%nproc_recv : ',gpt%nproc_recv
stop
end program test1
[/fortran]
[bash]ifort -Od typ.f90 build.f90 prg.f90 -FetypTurning optimization on, with the compiler versions listed above, shows the bug:
s:\LANG\test1.ifort\mini>typ
In sub build, sch%nproc_recv : 0
In main prog, gpt%nproc_recv : 0[/bash]
[bash]ifort -Ot typ.f90 build.f90 prg.f90 -FetypCommenting out the WRITE statement in build.f90 makes the bug go away, which is characteristic of optimizer bugs. As I wrote earlier, if the three files are combined into one file the bug goes away:
s:\LANG\test1.ifort\mini>typ
In sub build, sch%nproc_recv : 1
In main prog, gpt%nproc_recv : 0
[/bash]
[bash]$ cat typ.f90 build.f90 prg.f90 > all.f90
$ ifort -O2 all.f90
$ ./a.out
In sub build, sch%nproc_recv : 0
In main prog, gpt%nproc_recv : 0
[/bash]
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the compact reproducer. I appreciate it.
Bug ID is DPD200168665. This bug showed up in the 11.0 compiler first. 10.1 compilers are fine.
ron
Bug ID is DPD200168665. This bug showed up in the 11.0 compiler first. 10.1 compilers are fine.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do have a workaround: add this option:
-nolib-inline
at O1, O2 or O3 and it will avoid the bug.
ron
-nolib-inline
at O1, O2 or O3 and it will avoid the bug.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Excellent! Thank you, Ron.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This bug is fixed in the Composer XE 2011 Update 7 compiler, aka 12.1.1.256
ron
ron

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