[Bug fortran/55069] New: [4.7/4.8 Regression] TRIM incorrectly optimized out for assignment to allocatable string
quantheory at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Oct 25 00:17:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55069
Bug #: 55069
Summary: [4.7/4.8 Regression] TRIM incorrectly optimized out
for assignment to allocatable string
Classification: Unclassified
Product: gcc
Version: 4.7.3
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: quantheory@gmail.com
With -ffrontend-optimize turned on, in the following assignments, "str" is
allocated to a larger size than it should have:
character(len=2) :: blah
character(len=:), allocatable :: str
blah = "a"
! With -O, str will be set to "a ", else str == "a"
str = trim(blah)
! No effect with -O
str = trim(str)
! With -O str will be set to "ba ", else "ba"
str = "b"//trim(blah)
! This trim cannot be optimized out, so it yields "ab" either way.
str = trim(blah)//"b"
This problem with allocatable strings is noted in the original enhancement
proposal (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40628), but apparently
not addressed yet?
More information about the Gcc-bugs
mailing list