aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-03-03 18:20:32 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-03-03 18:20:32 +0000
commita900a060926fd8e770a5e0b660b7b4eb3fd9155a (patch)
tree1c2b002157fec392211d6e007f45058f0bfa3927 /gcc/fortran/simplify.c
parent88aa59ff7ede25ef44c0dafc2b06e2eaf9080d8a (diff)
downloadgcc-a900a060926fd8e770a5e0b660b7b4eb3fd9155a.zip
gcc-a900a060926fd8e770a5e0b660b7b4eb3fd9155a.tar.gz
gcc-a900a060926fd8e770a5e0b660b7b4eb3fd9155a.tar.bz2
re PR fortran/51434 (ICE with scalar init of an array parameter, used in DT default init with transfer)
2018-03-03 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/51434 * simplify.c (gfc_simplify_transfer): Resolve mold. 2018-03-03 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/51434 * gfortran.dg/pr51434.f90: New test. From-SVN: r258220
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 324f858..b130aba 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "gfortran.h"
#include "arith.h"
#include "intrinsic.h"
+#include "match.h"
#include "target-memory.h"
#include "constructor.h"
#include "version.h" /* For version_string. */
@@ -7370,10 +7371,12 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
unsigned char *buffer;
size_t result_length;
+ if (!gfc_is_constant_expr (source) || !gfc_is_constant_expr (size))
+ return NULL;
- if (!gfc_is_constant_expr (source)
- || (gfc_init_expr_flag && !gfc_is_constant_expr (mold))
- || !gfc_is_constant_expr (size))
+ if (!gfc_resolve_expr (mold))
+ return NULL;
+ if (gfc_init_expr_flag && !gfc_is_constant_expr (mold))
return NULL;
if (!gfc_calculate_transfer_sizes (source, mold, size, &source_size,