This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
gfortran bug
- From: howarth at bromo dot msbb dot uc dot edu (Jack Howarth)
- To: fortran at gcc dot gnu dot org
- Date: Fri, 10 Feb 2006 21:53:46 -0500 (EST)
- Subject: gfortran bug
The following code is miscompiled by gfortran from tonight's gcc 4.1
branch resulting in the a segfault...
../../../gcc-4.1-20060210/libgfortran/intrinsics/date_and_time.c:298: failed assertion `__time_len >= TIME_LEN'
Abort
The code is...
C=====================================================================
SUBROUTINE VTIME(A,AMAX,ALEN)
C
C this routine returns day time
C
IMPLICIT NONE
C input/output
CHARACTER*(*) A
INTEGER AMAX, ALEN
C local
CHARACTER DSTR*8, TSTR*9
C begin
IF (AMAX.LT.8) THEN
WRITE(6,'(A)') ' %VTIME-ERR: string to small'
ELSE
CALL DATE_AND_TIME(DSTR, TSTR)
A=TSTR(1:2)//':'//TSTR(3:4)//':'//TSTR(5:6)
ALEN=AMAX
END IF
RETURN
END
C=====================================================================
SUBROUTINE VINTIM
IMPLICIT NONE
INTEGER L
CHARACTER*8 TIME
CALL VTIME(TIME,8,L)
RETURN
END
PROGRAM HELLO
CALL VINTIM
STOP
END
This compiles and runs fine under g77.
Jack
ps The problem also seems to exist with the gfortran 4.0.2 in Fedora Core 4.