This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-19990824/g77 ICE on x86 with optimization


On both the targets i686-pc-linux-gnu and i586-pc-cygwin32, the
following subroutine produces ICE when compiled with 'g77 -c
-Os -funroll-loops'.  The code functions as expected if unrolling is
not invoked, or with a change to an earlier version or different
target architecture.  The compilers passed make compare when
built with CFLAGS='-Os -march=pentiumpro'.
Dr. Timothy C. Prince
Consulting Engineer
Solar Turbines, a Caterpillar Company
alternate e-mail: tprince@computer.org
C***********************************************
      subroutine stats(stat,x,n)
C***********************************************
C
C     UNWEIGHTED STATISTICS: MEAN, STADEV, MIN, MAX, HARMONIC MEAN.
C
C     STAT(1)= THE MEAN OF X.
C     STAT(2)= THE STANDARD DEVIATION OF THE MEAN OF X.
C     STAT(3)= THE MINIMUM OF X.
C     STAT(4)= THE MAXIMUM OF X.
C     STAT(5)= THE HARMONIC MEAN
C     X       IS THE ARRAY  OF INPUT VALUES.
C     n       IS THE NUMBER OF INPUT VALUES IN X.
C
C***********************************************
      implicitdoubleprecision (a-h,o-z)
CIBM  IMPLICIT  REAL*8           (A-H,O-Z)
C
      dimensionx(n),stat(20)
CLLL. OPTIMIZE LEVEL G
C
      call trace('STATS   ')
C
      do k= 1,9
	stat(k)= 0.0
	enddo
      if(n >  0)then
C                             CALCULATE MEAN OF X.
	  s= 0.0
	  do k= 1,n
	    s= s+x(k)
	    enddo
	  a= s/n
	  stat(1)= a
C                             CALCULATE STANDARD DEVIATION OF X.
	  d= 0.0
	  u= x(1)
	  v= x(1)
	  h= 0.0
	  do k= 1,n
	      d= d+(x(k)-a)**2
	      u= min(u,x(k))
	      v= max(v,x(k))
	      if(x(k).ne.0.0)then
		h= h+1.0/x(k)
		endif
	    enddo
	  d= d/n
	  stat(2)= sqrt(d)
C                             CALCULATE MINIMUM OF X.
	  stat(3)= u
C                             CALCULATE MAXIMUM OF X.
	  stat(4)= v
C                             CALCULATE HARMONIC MEAN OF X.
	  if(h.ne.0.0)then
	    h= (n)/h
	    endif
	  stat(5)= h
	endif
      call track('STATS   ')
      return
      end


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]