fortran/1645: cygwin optimization problem

David.Billinghurst@riotinto.com David.Billinghurst@riotinto.com
Sun Apr 1 00:00:00 GMT 2001


>Number:         1645
>Category:       fortran
>Synopsis:       cygwin optimization problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 14 04:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Billinghurst
>Release:        g77 version 2.97 20010102
>Organization:
>Environment:
cygwin 1.1.7 & NT4 SP5
>Description:
There are a number of LAPACK 3.0 failures on cygwin with current gcc snapshots.  This test case is derived from routine chgeqz.f and should a bug that causes failures in the cgg tests.

Bug is an optimization problem.  It is not present at -O0 or -O1, but is present at -O2 and higher.  The problem is in the DO loop in subroutine CHGEQZ.  The variable I is either not initialized to J (=4), or the value is lost.

This case is will be submitted to gcc-patches for inclusion in the fortran testsuite.

>How-To-Repeat:
g77 -O2 20010114.f
./a.exe

No output == success.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="20010114.f"
Content-Disposition: inline; filename="20010114.f"

*
*  Derived from LAPACK 3.0 routine CHGEQZ
*  Fails on i686-pc-cygwin with gcc-2.97 snapshots at -O2 and higher
*
*  David Billinghurst, (David.Billinghurst@riotinto.com)
*  14 January 2001
* 
      complex A(5,5)
      DATA A/25*(0.0,0.0)/
      a(4,3) = (0.05,0.2)/3.0E-7
      a(4,4) = (-0.03,-0.4)
      a(5,4) = (-2.0E-07,2.0E-07)
      call CHGEQZ( 5, A )
      end

      SUBROUTINE DUMMY()
      END

      SUBROUTINE DUMMY1(I)
      IF ( I .NE. 4 ) THEN
         WRITE(6,*) 'I = ', I, ' but should be 4'
         CALL ABORT()
      END IF
      END

      SUBROUTINE CHGEQZ( N, A )
      INTEGER   I, J, N
      COMPLEX   A(N,N), CTEMP, X
      REAL      TEMP, TEMP2, TEMPR, ABS1

      ABS1( X ) = ABS( REAL( X ) ) + ABS( AIMAG( X ) )

      DO J = 4, 2, -1
         I = J
         CTEMP = A( J, J )
         TEMP = ABS1( CTEMP )
         TEMP2 = ABS1( A( J+1, J ) )
         TEMPR = MAX( TEMP, TEMP2 )
         IF( (TEMPR .LT. 1.0) .AND. (TEMPR .NE. 0.0) ) THEN
            TEMP = TEMP / TEMPR
            TEMP2 = TEMP2 / TEMPR
         END IF
         IF (ABS1(A(J,J-1))*TEMP2.LE.TEMP ) GO TO 90
   80 END DO
c     Should not reach here, but need a subroutine call
      CALL DUMMY()

 90   CONTINUE
      CALL DUMMY1(I)
      RETURN
      END


More information about the Gcc-prs mailing list