Silverfrost Forums

Welcome to our forums

varying results caused by different compiler options

4 Feb 2008 8:03 #2732

Hello Paul,

a customer sent me the following sample program which is sorting some data. We would expect that the result is independent from the compiler options being used but unfortunately it is is not. It appears to me that there is a bug in the optimizer. Please check. Thank you.

Kind regards Jörg Kuthe www.qtsoftware.de


implicit none
integer index(10)
integer i,ii,j,jj,k,n character*1 cq(10),ci,cj data cq/'X','E','X','I','A','X','F','X','B','X'/ n=10 do i=1,n index(i)=i end do n=10 ! do i=1,9 CORRECT ! do i=1,n-1 file option: standard optimization WRONG ! do i=1,n-1 file option: full optimization WRONG
! do i=1,n-1 file option: include debug CORRECT ! do i=1,n-1 file option: checkmate enabled CORRECT do i=1,n-1 ii=index(i); ci=cq(ii); k=i
if (ci.eq.'X') cycle do j=i+1,n jj=index(j); cj=cq(jj)
if (cj.eq.'X') cycle
if (cq(jj).lt.ci) then ci=cq(jj)
ii=jj k=j
end if end do
index(k)=index(i) index(i)=ii end do
write(6,'(10i3)') index(1:n)
write(6,'(10(2x,a1))') (cq(index(i)),i=1,n) ! ! Faulty Result 1 9 3 2 5 6 7 8 4 10 ! X B X E A X F X I X ! ! Correct Result 1 5 3 9 2 6 7 8 4 10 ! X A X B E X F X I X stop end

4 Feb 2008 10:14 #2736

Jörg

We will take a look at this and get back to you as soon as we can.

Regards

Paul

6 Mar 2008 4:34 #2895

This bug has been fixed for the release that is about to go out.

Please login to reply.