Bug 40358 - nternal error: Segmentation Fault (program f951) on Solaris.
Summary: nternal error: Segmentation Fault (program f951) on Solaris.
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.2
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-05 21:24 UTC by Dr. David Kirkby
Modified: 2009-06-05 22:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dr. David Kirkby 2009-06-05 21:24:43 UTC
The following bit of code generates an internal compiler error on a Sun T5240. Using the *exact* same binary on a Sun Blade 2000, no internal error is generated. 

kirkby@t2:~$ gfortran secondtst.f
gfortran: Internal error: Segmentation Fault (program f951)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


Here's the bit of code. I did not write it, and do not even known Fortran well, so I've no idea if the code is good/bad, but the compiler should not generate an internal error. 


kirkby@t2:~$ cat  secondtst.f
      PROGRAM TEST4
*
*  -- LAPACK test routine (version 3.1) --
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
*     November 2006
*
*     .. Parameters ..
      INTEGER            NMAX, ITS
      PARAMETER          ( NMAX = 100, ITS = 5000 )
*     ..
*     .. Local Scalars ..
      INTEGER            I, J
      REAL               ALPHA, AVG, T1, T2, TNOSEC
*     ..
*     .. Local Arrays ..
      REAL               X( NMAX ), Y( NMAX )
*     ..
*     .. External Functions ..
      REAL               SECOND
      EXTERNAL           SECOND
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          REAL
*     ..
*     .. Executable Statements ..
*
*
*     Initialize X and Y
*
      DO 10 I = 1, NMAX
         X( I ) = REAL( 1 ) / REAL( I )
         Y( I ) = REAL( NMAX-I ) / REAL( NMAX )
   10 CONTINUE
      ALPHA = 0.315
*
*     Time 1,000,000 SAXPY operations
*
      T1 = SECOND( )
      DO 30 J = 1, ITS
         DO 20 I = 1, NMAX
            Y( I ) = Y( I ) + ALPHA*X( I )
   20    CONTINUE
         ALPHA = -ALPHA
   30 CONTINUE
      T2 = SECOND( )
      WRITE( 6, 9999 )T2 - T1
      IF( T2-T1.GT.0.0 ) THEN
         WRITE( 6, 9998 )1.0 / ( T2-T1 )
      ELSE
         WRITE( 6, 9994 )
      END IF
      TNOSEC = T2 - T1
*
*     Time 1,000,000 SAXPY operations with SECOND in the outer loop
*
      T1 = SECOND( )
      DO 50 J = 1, ITS
         DO 40 I = 1, NMAX
            Y( I ) = Y( I ) + ALPHA*X( I )
   40    CONTINUE
         ALPHA = -ALPHA
         T2 = SECOND( )
   50 CONTINUE
*
*     Compute the time used in milliseconds used by an average call
*     to SECOND.
*
      WRITE( 6, 9997 )T2 - T1
      AVG = ( ( T2-T1 ) - TNOSEC ) * 1000./REAL( ITS )
      WRITE( 6, 9996 )AVG
*
*     Compute the equivalent number of floating point operations used
*     by an average call to SECOND.
*
      IF( TNOSEC.GT.0.0 )
     $   WRITE( 6, 9995 )1000.*AVG / TNOSEC
*
 9999 FORMAT( ' Time for 1,000,000 SAXPY ops  = ', G10.3, ' seconds' )
 9998 FORMAT( ' SAXPY performance rate        = ', G10.3, ' mflops ' )
 9997 FORMAT( ' Including SECOND, time        = ', G10.3, ' seconds' )
 9996 FORMAT( ' Average time for SECOND       = ', G10.3,
     $      ' milliseconds' )
 9995 FORMAT( ' Equivalent floating point ops = ', G10.3, ' ops' )
 9994 FORMAT( ' *** Error:  Time for operations was zero' )
      CALL MYSUB(NMAX,X,Y)
      END
      SUBROUTINE MYSUB(N,X,Y)
      INTEGER N
      REAL X(N), Y(N)
      RETURN
      END
Comment 1 Dominique d'Humieres 2009-06-05 21:45:32 UTC
Works for me on i686-apple-darwin9 if I remove the lines:

      REAL               SECOND
      EXTERNAL           SECOND

since SECOND is a gfortran intrinsic.
Comment 2 Dr. David Kirkby 2009-06-05 22:10:35 UTC
Thanks. On closer inspection, it appears compilation, which was performed on one SPARC and moved to another is broken quite seriously. Ignore this bug report. 

dave 
Comment 3 Jerry DeLisle 2009-06-05 22:58:52 UTC
Not a bug in gfortran.