aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2019-02-24 20:03:28 +0000
committerHarald Anlauf <anlauf@gcc.gnu.org>2019-02-24 20:03:28 +0000
commitcdd1793162ce3a8dc1c0d067f1af173eee98da0f (patch)
treef8023f584e66c89d7f50649bb609e9124f0aab15 /gcc/fortran/check.c
parent953e25c44acc2458d854b1442d7775d997aaf187 (diff)
downloadgcc-cdd1793162ce3a8dc1c0d067f1af173eee98da0f.zip
gcc-cdd1793162ce3a8dc1c0d067f1af173eee98da0f.tar.gz
gcc-cdd1793162ce3a8dc1c0d067f1af173eee98da0f.tar.bz2
re PR fortran/89266 (ICE with TRANSFER of len=0 character array constructor)
2019-02-24 Harald Anlauf <anlauf@gmx.de> PR fortran/89266 PR fortran/88326 * target-memory.c (gfc_element_size): Return false if element size cannot be determined; element size is returned separately. (gfc_target_expr_size): Return false if expression size cannot be determined; expression size is returned separately. * target-memory.h: Adjust prototypes. * check.c (gfc_calculate_transfer_sizes): Adjust references to gfc_target_expr_size, gfc_element_size. * arith.c (hollerith2representation): Likewise. * class.c (find_intrinsic_vtab): Likewise. * simplify.c (gfc_simplify_sizeof): Likewise. PR fortran/89266 PR fortran/88326 * gfortran.dg/pr89266.f90: New test. * gfortran.dg/pr88326.f90: New test. From-SVN: r269177
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r--gcc/fortran/check.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index c60de6b..0367c92 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5480,16 +5480,15 @@ gfc_calculate_transfer_sizes (gfc_expr *source, gfc_expr *mold, gfc_expr *size,
return false;
/* Calculate the size of the source. */
- *source_size = gfc_target_expr_size (source);
- if (*source_size == 0)
+ if (!gfc_target_expr_size (source, source_size))
return false;
/* Determine the size of the element. */
- result_elt_size = gfc_element_size (mold);
- if (result_elt_size == 0)
+ if (!gfc_element_size (mold, &result_elt_size))
return false;
- if (mold->expr_type == EXPR_ARRAY || mold->rank || size)
+ if ((result_elt_size > 0 && (mold->expr_type == EXPR_ARRAY || mold->rank))
+ || size)
{
int result_length;