This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g77 -O1 -funroll-loops produces bad code
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: g77 -O1 -funroll-loops produces bad code
- From: Ovidiu Toader <ovi at physics dot utoronto dot ca>
- Date: Sat, 27 Feb 1999 18:00:34 -0500
- Organization: University of Toronto
A user has found that a fortran code which used to work fine 2 months
ago now gets a SIGSEGV when compiled with -O1 -funroll-loops. The egcs
tree is kept almost in sync with the latest snapshots.
I've trimmed down the code as much as possible. At this point the
SIGSEGV is received in a different location than the original SIGSEGV.
The declarations are from the original code and ALL of them are needed
to trigger the bug!!
--
Ovidiu
toucan:~/work/f77> uname -a
Linux toucan.physics.utoronto.ca 2.0.36 #3 Sat Jan 9 19:07:50 EST 1999
i686 unknown
toucan:~/work/f77> g77 -v
g77 version egcs-2.93.09 19990221 (gcc2 ss-980929 experimental) (from
FSF-g77 version 0.5.24-19990219)
...........................................................
toucan:~/work/f77> cat bug.f
c g77 -O1 -funroll-loops
c These declarations are needed to trigger the bug!!!!!!
implicit none
INTEGER Ncell, N, LWORK, Nsites, Nhole, Nele, Nsvd
DOUBLE PRECISION u, S, errmax, eta
parameter(Ncell=20 ,Nsites=2*Ncell, N=2*Nsites,LWORK=3*N-1)
parameter(u=8.d0, S=0.5d0, errmax=1.d-6)
parameter(Nhole=1, Nele=Nsites-Nhole)
parameter(eta=0.d0)
parameter(Nsvd=4*Nsites)
integer LDA, INFO, i, j, kp, kh, k, num
integer kp2, kh2, i1
integer crit
character JOBZ, UPLO, BOUNDARY
logical flag
DOUBLE PRECISION Spinx(Nsites), Spinz(Nsites), Dens(Nsites)
DOUBLE PRECISION A(N,N), W(N), WORK(LWORK), val
double precision ca, sav, delta
DOUBLE PRECISION wo, csihp
complex*16 M(Nsvd, Nsvd), ima, dw1, dw2,cond,condo
complex*16 csi(Nsvd), bi(Nsvd), D
CHARACTER JOBU, JOBVT
INTEGER LWORK1
parameter( LWORK1=4*Nsvd)
DOUBLE PRECISION RWORK(5*Nsvd-4), Sing(Nsvd)
COMPLEX*16 Uma(Nsvd,Nsvd),VT(Nsvd,Nsvd),WORK1(LWORK1)
do i=1,Nsites
Spinx(i) = i
Spinz(i) = i
Dens(i) = i
enddo
do i=1,N
do j=1,N
A(i,j)=1.d0
enddo
enddo
end
toucan:~/work/f77> g77 -O1 bug.f -o exe
toucan:~/work/f77> exe
toucan:~/work/f77> g77 -O1 -funroll-loops bug.f -o exe
toucan:~/work/f77> exe
Segmentation fault