This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Error trace in GFortran?
- From: Philippe Schaffnit <P dot Schaffnit at access dot rwth-aachen dot de>
- To: GFortran <fortran at gcc dot gnu dot org>
- Date: Mon, 10 Apr 2006 12:38:38 +0200
- Subject: Error trace in GFortran?
- Organization: Access e.V.
Hi!
I've been looking around for a 'trace back' extension, which I do not
seem to find in GFortran. This is by no means a must have, but if it can
be easily implemented, it might be nice to put it on a 'whish list'...
lf95 and cvf both have something similare ('A trace back map is
generated for the program unit being executed.' to quote the lahey
documentation), this is very handy with multi-purpose error handling
routines... (see example hereafter).
Did I overlook something, and is there already a way of doing that with
GFortran?
Thanks!
Philippe
PS: what I mean: the following source:
!
PROGRAM Show_Error_Trace
!
INTEGER :: k
!
DO k = 1, 10, 3
WRITE ( 6, "(I2)" ) k
CALL Check_Not_Zero ( k )
END DO
!
DO k = 20, -10, -10
WRITE ( 6, "(I2)" ) k
CALL Check_Not_Zero ( k )
END DO
!
CONTAINS
SUBROUTINE Check_Not_Zero ( Number )
INTEGER, INTENT ( IN ) :: Number
IF ( Number .EQ. 0 ) THEN
CALL ERRTRA
STOP
ENDIF
END SUBROUTINE Check_Not_Zero
!
END PROGRAM Show_Error_Trace
!
gives the following output with lf95:
1
4
7
10
20
10
0
Error occurs at or near line 20 of show_error_trace.check_not_zero_
Called from or near line 13 of MAIN__