[Bug fortran/40628] New: Assignment using "= trim(string)": Optimize "trim" away

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Jul 3 07:16:00 GMT 2009


In assignments, such as
  string = trim(string)
  string(n1:n2) = trim(string)
the trim has no effect and can be optimized away.

(Note: With Fortran 2003 and allocatable strings with "len=:", the first
version cannot be optimized as on length mismatch the LHS is reallocated.)

Such code can easily be present in real-world code and causes unnecessarily a
large overhead, cf. e.g. http://www.tddft.org/trac/octopus/changeset/5672


-- 
           Summary: Assignment using "= trim(string)": Optimize "trim" away
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list