diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2008-04-15 19:40:33 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2008-04-15 19:40:33 +0000 |
commit | 05e6ff800954c29574733306d4d90cdac37213af (patch) | |
tree | 59ee16cb04dea8003eed6c925cb18e68f36fa439 /gcc | |
parent | 69c32ec801a7b3b42778231b8187e77b8c63d0f2 (diff) | |
download | gcc-05e6ff800954c29574733306d4d90cdac37213af.zip gcc-05e6ff800954c29574733306d4d90cdac37213af.tar.gz gcc-05e6ff800954c29574733306d4d90cdac37213af.tar.bz2 |
re PR fortran/35864 (Revision 133965 broke gfortran.dg/initialization_1.f90)
2008-04-15 Paul Thomas <pault@gcc.gnu.org>
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 11 |
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a282623..dd5ef5b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2008-04-15 Paul Thomas <pault@gcc.gnu.org> + + 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 <jvdelisle@gcc.gnu.org> Tobias Burnus <burnus@net-b.de> diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 12e88a0..70914c1 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]; |