re PR fortran/91784 (ICE in gfc_real2complex, at fortran/arith.c:2208)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 2 Oct 2019 17:17:55 +0000 (17:17 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 2 Oct 2019 17:17:55 +0000 (17:17 +0000)
2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91784
* simplify.c (gfc_convert_constant): Simplify expression if the
expres ion type is EXPR_OP.

2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91784
* gfortran.dg/pr91784.f90: New test.

From-SVN: r276474

gcc/fortran/ChangeLog
gcc/fortran/simplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr91784.f90 [new file with mode: 0644]

index bf8702f2e9d997b59ef2af42383153a1a9bd1bbb..ea1177f4553876f036eed3e5d8e10be9f29c209a 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91784
+       * simplify.c (gfc_convert_constant): Simplify expression if the
+       expression type is EXPR_OP.
+
 2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91785
index 3d2fc0d956fffabda9aa19733ea2b7a6c6a005e1..32ebcc04121341c52f14720dab8bc7a19952c4ce 100644 (file)
@@ -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
index cdd99ef0c1d7033544160a662e42f8a96ec99cf0..0bc13fc1b630572e72068f3673d591a1a160ada9 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91784
+       * gfortran.dg/pr91784.f90: New test.
+
 2019-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91785
diff --git a/gcc/testsuite/gfortran.dg/pr91784.f90 b/gcc/testsuite/gfortran.dg/pr91784.f90
new file mode 100644 (file)
index 0000000..25280e0
--- /dev/null
@@ -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