aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-12-09 09:17:24 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-12-09 09:17:24 +0000
commit28d08315ed4962e850886887085d35e135d6a34e (patch)
tree20e58b82c3459ec5c5b1e896dcce5b3ad27987fb /gcc/fortran/expr.c
parent4d19dfcf675fcdcb5bd690ef3f67c8daf0f019df (diff)
downloadgcc-28d08315ed4962e850886887085d35e135d6a34e.zip
gcc-28d08315ed4962e850886887085d35e135d6a34e.tar.gz
gcc-28d08315ed4962e850886887085d35e135d6a34e.tar.bz2
re PR fortran/32129 (ICE: Procedure call with array-section-actual to scalar dummy)
2007-12-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/32129 * dump-parse-tree.c (gfc_show_expr_n): New function for debugging. * gfortran.h : Add prototype for gfc_show_expr_n. * expr.c (simplify_constructor): Copy the constructor expression and try to simplify that. If success, replace the original. Otherwise discard the copy, keep going through the structure and return success. PR fortran/31487 * decl.c (build_struct): Pad out default initializers with spaces to the component character length. 2007-12-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/32129 * gfortran.dg/derived_comp_array_ref_6.f90: New test. * gfortran.dg/derived_comp_array_ref_7.f90: New test. PR fortran/31487 * gfortran.dg/char_component_initializer_1.f90: New test. From-SVN: r130719
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 1242e5e..255acb6 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -963,6 +963,8 @@ simplify_intrinsic_op (gfc_expr *p, int type)
static try
simplify_constructor (gfc_constructor *c, int type)
{
+ gfc_expr *p;
+
for (; c; c = c->next)
{
if (c->iterator
@@ -971,8 +973,21 @@ simplify_constructor (gfc_constructor *c, int type)
|| gfc_simplify_expr (c->iterator->step, type) == FAILURE))
return FAILURE;
- if (c->expr && gfc_simplify_expr (c->expr, type) == FAILURE)
- return FAILURE;
+ if (c->expr)
+ {
+ /* Try and simplify a copy. Replace the original if successful
+ but keep going through the constructor at all costs. Not
+ doing so can make a dog's dinner of complicated things. */
+ p = gfc_copy_expr (c->expr);
+
+ if (gfc_simplify_expr (p, type) == FAILURE)
+ {
+ gfc_free_expr (p);
+ continue;
+ }
+
+ gfc_replace_expr (c->expr, p);
+ }
}
return SUCCESS;