- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
The reproducer given below is a simplified adaptation (no reals, smaller arrays, bound checking not involved) of a recently reported bug.
[fortran]! IFort 11.1.073 on Linux IA32 or X64
! Different output with -save -O0
! and -save -O1
program optbug
implicit none
integer :: i, sout
do i=1,2
call sub(i,sout)
write(*,'(1x,I3,2x,I4)')i,sout
end do
end program optbug
! shift values in array dh every second call
subroutine sub(rinp,rout)
implicit none
integer, parameter :: dim = 2
integer :: i, iframe, rinp, rout, dh(dim)
! save iframe,dh
! first call: set default values in array dh
if(rinp.eq.1) then
dh(1:dim)=(/ (i,i=1,dim) /)
iframe=0
endif
if (iframe .eq. 0) then
iframe = 1
do i = 1,dim-1
dh(i) = dh(i+1)
end do
dh(dim) = rinp
else
iframe = 0
end if
rout = dh(dim)
return
end subroutine sub
[/fortran] With the current issues (11.1.073) of the IA-32 and Intel64 compilers, with no options specified in ifort.cfg, here are the results: Note that the -save option is being used in lieu of the SAVE specification in the subroutine. The program assumes that the first argument to the subroutine will be equal to 1 at the first call.[bash]$ ifort -save -O0 bb.f90 $ ./a.out 1 1 2 1
$ ifort -save -O1 bb.f90
$ ./a.out
1 1
2 2
[/bash]
Link kopiert
1 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Thank you very much, mecej4.It is helpful to have check bounds eliminated.This variant is also fixed in the upcoming major release. I will include this in the report to Development and keep this thread updated along with the earlier one.
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite