[Bug fortran/53357] New: Add -fcheck=bounds for character type-spec in ALLOCATE
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue May 15 09:41:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53357
Bug #: 53357
Summary: Add -fcheck=bounds for character type-spec in ALLOCATE
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
Example: The following is invalid as the length does not match:
integer :: i
i = 5
block
character(len=i), allocatable :: str
allocate (character(len=3) :: str)
end block
end
* * *
That's already correctly detected for compile-time constants:
character(len=5), allocatable :: str
allocate (character(len=3) :: str)
end
Error: Allocating str at (1) with type-spec requires the same character-length
parameter as in the declaration
However, the compile-time version could also print the bounds.
More information about the Gcc-bugs
mailing list