summaryrefslogtreecommitdiff
path: root/gcc/fortran/frontend-passes.c
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-11 08:22:35 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-11 08:22:35 +0000
commitfafd9c3064b4062d749751c20e53f731f9c1cd8e (patch)
treefde0740af1e7c95d4eb70f492675b55b2699317c /gcc/fortran/frontend-passes.c
parent2b5f213d21e8b5e14efd1eef180e744e6ac070ea (diff)
downloadgcc-fafd9c3064b4062d749751c20e53f731f9c1cd8e.tar.gz
2011-05-11 Thomas Koenig <tkoenig@gcc.gnu.org>
* frontend-passes.c (optimize_assignment): Follow chains of concatenation operators to the end for removing trailing TRIMS for assignments. 2011-05-11 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/trim_optimize_7.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174944 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/frontend-passes.c')
-rw-r--r--gcc/fortran/frontend-passes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index f100e1fb811..d1cc22979b7 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -500,6 +500,14 @@ optimize_assignment (gfc_code * c)
if (lhs->ts.type == BT_CHARACTER)
{
+ /* Check for a // b // trim(c). Looping is probably not
+ necessary because the parser usually generates
+ (// (// a b ) trim(c) ) , but better safe than sorry. */
+
+ while (rhs->expr_type == EXPR_OP
+ && rhs->value.op.op == INTRINSIC_CONCAT)
+ rhs = rhs->value.op.op2;
+
if (rhs->expr_type == EXPR_FUNCTION &&
rhs->value.function.isym &&
rhs->value.function.isym->id == GFC_ISYM_TRIM)