I ran the gfortran testsuite with -fbounds-check and found a few failures (on
i686-linux), among which was gfortran.dg/aliasing_dummy_1.f90. Here is a
reduced testcase:
program test_lex
type :: dtype
character*5 :: word
end type dtype
type :: list
type(dtype) :: list(1)
end type list
type(list) :: table
call foo1 (table%list(1)%word)
contains
subroutine foo1 (slist)
character(*), dimension(*) :: slist
write (slist(1), '(i5)') 0
end subroutine foo1
end program test_lex
$ gfortran -fbounds-check bug.f90 && ./a.out
Fortran runtime error: Array reference out of bounds
--
Summary: -fbounds-check gives undue warning with
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fxcoudert at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27765