From 05e6ff800954c29574733306d4d90cdac37213af Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Tue, 15 Apr 2008 19:40:33 +0000 Subject: [PATCH] re PR fortran/35864 (Revision 133965 broke gfortran.dg/initialization_1.f90) 2008-04-15 Paul Thomas PR fortran/35864 * expr.c (scalarize_intrinsic_call): Reorder identification of array argument so that if one is not found a segfault does not occur. Return FAILURE if all scalar arguments. From-SVN: r134329 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/expr.c | 11 +++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a282623da15..dd5ef5bef6a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2008-04-15 Paul Thomas + + PR fortran/35864 + * expr.c (scalarize_intrinsic_call): Reorder identification of + array argument so that if one is not found a segfault does not + occur. Return FAILURE if all scalar arguments. + 2008-04-13 Jerry DeLisle Tobias Burnus diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 12e88a07420..70914c14aab 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1704,14 +1704,11 @@ scalarize_intrinsic_call (gfc_expr *e) gfc_expr *expr, *old; int n, i, rank[5], array_arg; - old = gfc_copy_expr (e); - - /* Find which, if any, arguments are arrays. Assume that the old expression carries the type information and that the first arg that is an array expression carries all the shape information.*/ n = array_arg = 0; - a = old->value.function.actual; + a = e->value.function.actual; for (; a; a = a->next) { n++; @@ -1723,7 +1720,9 @@ scalarize_intrinsic_call (gfc_expr *e) } if (!array_arg) - goto cleanup; + return FAILURE; + + old = gfc_copy_expr (e); gfc_free_constructor (expr->value.constructor); expr->value.constructor = NULL; @@ -1763,7 +1762,7 @@ scalarize_intrinsic_call (gfc_expr *e) } - /* Using the first argument as the master, step through the array + /* Using the array argument as the master, step through the array calling the function for each element and advancing the array constructors together. */ ctor = args[array_arg - 1]; -- 2.30.2