From: Paul Thomas Date: Thu, 18 Oct 2007 12:44:03 +0000 (+0000) Subject: re PR fortran/33733 (ICEs in simplify_transfer) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2dc955484e85876217366340ac2ba1cacc71b9f6;p=gcc.git re PR fortran/33733 (ICEs in simplify_transfer) 2007-10-18 Paul Thomas Dominique d'Humieres PR fortran/33733 * simplify.c (gfc_simplify_transfer): Return null if the source expression is EXPR_FUNCTION. 2007-10-18 Paul Thomas PR fortran/33733 * gfortran.dg/transfer_simplify_6.f90: New test. From-SVN: r129435 --- diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index c9885ddd90f..0bb13c14adb 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4011,6 +4011,9 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size) || !gfc_is_constant_expr (size)) return NULL; + if (source->expr_type == EXPR_FUNCTION) + return NULL; + /* Calculate the size of the source. */ if (source->expr_type == EXPR_ARRAY && gfc_array_size (source, &tmp) == FAILURE) diff --git a/gcc/testsuite/gfortran.dg/transfer_simplify_6.f90 b/gcc/testsuite/gfortran.dg/transfer_simplify_6.f90 new file mode 100644 index 00000000000..b557c064f0e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/transfer_simplify_6.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! Checks the fix for PR33733, in which the functions of arrays +! for the 'source' argument would cause an ICE. +! +! Contributed by FX Coudert +! + print *, transfer(sqrt([100.]), 0_1) + print *, transfer(achar([100]), 0_1) +end