Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/1a93179a80b6e6e8
The following program is invalid as the passed character string is too short
for the dummy argument. gfortran detects this at compile time (if contained)
and prints a warning; however, I expect that it also detects this at run time
with -fbounds-check.
This should be quite easy as substr has:
substr (strng, _strng)
i.e. the _strng size can be compared at run time.
(Note: Using "character(len=n)" the string length of the dummy might not be
known at compile time either.)
PROGRAM TST_STRING
CALL SUBSTR('HELLO THE WETHER IS NICE')
CALL SUBSTR('HELLO THE WETHER IS ')
CALL SUBSTR('HELLO THE WETHER ')
STOP
! CONTAINS
END
SUBROUTINE SUBSTR(STRNG)
CHARACTER(24) STRNG
WRITE(6,*) 'STRING=', STRNG
RETURN
END SUBROUTINE
! END PROGRAM
--
Summary: -fbounds-check: actual character string shorter than
dummy
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 27766
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35943