diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2019-12-21 16:19:42 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2019-12-21 16:19:42 +0000 |
commit | b1f16cae7dda8111a41bd351be63c808d593546d (patch) | |
tree | 813ec5f2d55660383daf822fe5fb5c5934d93a75 /gcc/fortran | |
parent | a09ccc22459c565814f79f96586fe4ad083fe4eb (diff) | |
download | gcc-b1f16cae7dda8111a41bd351be63c808d593546d.zip gcc-b1f16cae7dda8111a41bd351be63c808d593546d.tar.gz gcc-b1f16cae7dda8111a41bd351be63c808d593546d.tar.bz2 |
re PR fortran/92753 (ICE in gfc_trans_call, at fortran/trans-stmt.c:392)
2019-12-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/92753
* expr.c (find_inquiry_ref): Catch INQUIRY_LEN case, where the
temporary expression has been converted to a constant and make
the new expression accordingly. Correct the error in INQUIRY_RE
and INQUIRY_IM cases. The original rather than the resolved
expression was being used as the source in mpfr_set.
2019-12-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/92753
* gfortran.dg/inquiry_type_ref_5.f90 : New test.
From-SVN: r279696
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 14 |
2 files changed, 18 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7e67390..dee20f6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2019-12-21 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/92753 + * expr.c (find_inquiry_ref): Catch INQUIRY_LEN case, where the + temporary expression has been converted to a constant and make + the new expression accordingly. Correct the error in INQUIRY_RE + and INQUIRY_IM cases. The original rather than the resolved + expression was being used as the source in mpfr_set. + 2019-12-20 Jakub Jelinek <jakub@redhat.com> PR middle-end/91512 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index fc67a9d..aea4af0 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1787,11 +1787,15 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp) if (!gfc_notify_std (GFC_STD_F2003, "LEN part_ref at %C")) goto cleanup; - if (!tmp->ts.u.cl->length - || tmp->ts.u.cl->length->expr_type != EXPR_CONSTANT) + if (tmp->ts.u.cl->length + && tmp->ts.u.cl->length->expr_type == EXPR_CONSTANT) + *newp = gfc_copy_expr (tmp->ts.u.cl->length); + else if (tmp->expr_type == EXPR_CONSTANT) + *newp = gfc_get_int_expr (gfc_default_integer_kind, + NULL, tmp->value.character.length); + else goto cleanup; - *newp = gfc_copy_expr (tmp->ts.u.cl->length); break; case INQUIRY_KIND: @@ -1814,7 +1818,7 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp) *newp = gfc_get_constant_expr (BT_REAL, tmp->ts.kind, &tmp->where); mpfr_set ((*newp)->value.real, - mpc_realref (p->value.complex), GFC_RND_MODE); + mpc_realref (tmp->value.complex), GFC_RND_MODE); break; case INQUIRY_IM: @@ -1826,7 +1830,7 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp) *newp = gfc_get_constant_expr (BT_REAL, tmp->ts.kind, &tmp->where); mpfr_set ((*newp)->value.real, - mpc_imagref (p->value.complex), GFC_RND_MODE); + mpc_imagref (tmp->value.complex), GFC_RND_MODE); break; } tmp = gfc_copy_expr (*newp); |