Lots of bounds-checking errors in this program...

$ cat string_check.f90
program main
  character (len=4) :: a,b
  character (len=1) :: c
  a = 'aa  '
  b = trim(a)   ! RHS is too short
  a = repeat('b', 2)  ! RHS is too short
  c = trim(a)          ! LHS is too short, string out of bounds
  c = repeat('b', 2)   ! LHS is too short, string out of bounds
  c = a                ! LHS is too short, string out of bounds
end program main
$ gfortran -fbounds-check string_check.f90
$ ./a.out
$


-- 
           Summary: Bounds checking for string functions
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
OtherBugsDependingO 27766
             nThis:


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

Reply via email to