From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29457 invoked by alias); 3 Jul 2009 07:16:11 -0000 Received: (qmail 29390 invoked by uid 48); 3 Jul 2009 07:15:54 -0000 Date: Fri, 03 Jul 2009 07:16:00 -0000 Subject: [Bug fortran/40628] New: Assignment using "= trim(string)": Optimize "trim" away X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg00224.txt.bz2 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