public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35943]  New: -fbounds-check: actual character string shorter than dummy
@ 2008-04-15 13:54 burnus at gcc dot gnu dot org
  2009-01-04  8:41 ` [Bug fortran/35943] " domob at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-04-15 13:54 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/35943] -fbounds-check: actual character string shorter than dummy
  2008-04-15 13:54 [Bug fortran/35943] New: -fbounds-check: actual character string shorter than dummy burnus at gcc dot gnu dot org
@ 2009-01-04  8:41 ` domob at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-01-04  8:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from domob at gcc dot gnu dot org  2009-01-04 08:40 -------


*** This bug has been marked as a duplicate of 37746 ***


-- 

domob at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35943


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-04  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-15 13:54 [Bug fortran/35943] New: -fbounds-check: actual character string shorter than dummy burnus at gcc dot gnu dot org
2009-01-04  8:41 ` [Bug fortran/35943] " domob at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).