From c20a90e0c82f7037f1064693ceb17a58e4682c22 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Wed, 2 Oct 2019 17:17:55 +0000 Subject: [PATCH] re PR fortran/91784 (ICE in gfc_real2complex, at fortran/arith.c:2208) 2019-10-02 Steven G. Kargl PR fortran/91784 * simplify.c (gfc_convert_constant): Simplify expression if the expres ion type is EXPR_OP. 2019-10-02 Steven G. Kargl PR fortran/91784 * gfortran.dg/pr91784.f90: New test. From-SVN: r276474 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/simplify.c | 6 +++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr91784.f90 | 9 +++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr91784.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bf8702f..ea1177f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2019-10-02 Steven G. Kargl + PR fortran/91784 + * simplify.c (gfc_convert_constant): Simplify expression if the + expression type is EXPR_OP. + +2019-10-02 Steven G. Kargl + PR fortran/91785 * primary.c (gfc_match_varspec): Ensure an inquiry parameter has it locus set. diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 3d2fc0d..32ebcc0 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -8508,10 +8508,10 @@ gfc_convert_constant (gfc_expr *e, bt type, int kind) { if (c->expr->expr_type == EXPR_ARRAY) tmp = gfc_convert_constant (c->expr, type, kind); - else if (c->expr->expr_type == EXPR_OP - && c->expr->value.op.op == INTRINSIC_PARENTHESES) + else if (c->expr->expr_type == EXPR_OP) { - gfc_simplify_expr (c->expr, 1); + if (!gfc_simplify_expr (c->expr, 1)) + return &gfc_bad_expr; tmp = f (c->expr, kind); } else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cdd99ef..0bc13fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2019-10-02 Steven G. Kargl + PR fortran/91784 + * gfortran.dg/pr91784.f90: New test. + +2019-10-02 Steven G. Kargl + PR fortran/91785 * gfortran.dg/pr91785.f90: New test. diff --git a/gcc/testsuite/gfortran.dg/pr91784.f90 b/gcc/testsuite/gfortran.dg/pr91784.f90 new file mode 100644 index 0000000..25280e0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91784.f90 @@ -0,0 +1,9 @@ +! { dg-do run } +! PR fortran/91784 +! Code originally contributed by Gerhard Steinmetz +program p + complex :: x(1) + x = (1.0, 2.0) * [real :: -(3.0 + 4.0)] + if (int(real(x(1))) /= -7) stop 1 + if (int(aimag(x(1))) /= -14) stop 2 +end -- 2.7.4