aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-10-18 12:44:03 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-10-18 12:44:03 +0000
commit2dc955484e85876217366340ac2ba1cacc71b9f6 (patch)
tree78b764aa11db8a305689cf048eea74d3865c3291 /gcc
parent741e7594bec656ff6a5bc2e7e83655e86880e868 (diff)
downloadgcc-2dc955484e85876217366340ac2ba1cacc71b9f6.zip
gcc-2dc955484e85876217366340ac2ba1cacc71b9f6.tar.gz
gcc-2dc955484e85876217366340ac2ba1cacc71b9f6.tar.bz2
re PR fortran/33733 (ICEs in simplify_transfer)
2007-10-18 Paul Thomas <pault@gcc.gnu.org> Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/33733 * simplify.c (gfc_simplify_transfer): Return null if the source expression is EXPR_FUNCTION. 2007-10-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/33733 * gfortran.dg/transfer_simplify_6.f90: New test. From-SVN: r129435
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/simplify.c3
-rw-r--r--gcc/testsuite/gfortran.dg/transfer_simplify_6.f909
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index c9885ddd..0bb13c1 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 0000000..b557c06
--- /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 <fxcoudert@gcc.gnu.org>
+!
+ print *, transfer(sqrt([100.]), 0_1)
+ print *, transfer(achar([100]), 0_1)
+end