re PR fortran/91553 (ICE in gfc_real2complex, at fortran/arith.c:2208)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 11 Sep 2019 18:37:31 +0000 (18:37 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Wed, 11 Sep 2019 18:37:31 +0000 (18:37 +0000)
2019-09-11  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91553
* simplify.c (gfc_convert_constant):  During conversion check if the
constant is enclosed in parenthesis, and simplify expression.

2019-09-11  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91553
* gfortran.dg/pr91553.f90: New test.

From-SVN: r275657

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

index b3770ce04541808b4e61e7e6aab0e1c7b6d70818..17021990936f1c246f64ac699c830856e7444c0f 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-11  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91553
+       * simplify.c (gfc_convert_constant):  During conversion check if the
+       constant is enclosed in parenthesis, and simplify expression.
+
 2019-09-11  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91642
index 7fc18d53925459588ea5bbf47b282d11acaa0863..023eedb749cbe2c453a70e5e94bacdfcf3a31d8a 100644 (file)
@@ -8503,6 +8503,12 @@ 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)
+               {
+                 gfc_simplify_expr (c->expr, 1);
+                 tmp = f (c->expr, kind);
+               }
              else
                tmp = f (c->expr, kind);
            }
index 6c316ee7f93f335d967d528fec0b713b3aa72225..546da4e7eeff1a9251eb073e7c17d490ffffbad5 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-11  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/91553
+       * gfortran.dg/pr91553.f90: New test.
+
 2019-09-11  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91642
diff --git a/gcc/testsuite/gfortran.dg/pr91553.f90 b/gcc/testsuite/gfortran.dg/pr91553.f90
new file mode 100644 (file)
index 0000000..2d0b018
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do run }
+! Code contributed by Gerhard Steinmetz
+program p
+   complex z(1)
+   z = (1.0, 2.0) * [real :: (3.0 + 4.0)]
+   if (real(z(1)) /= 7.) stop 1
+   if (aimag(z(1)) /= 14.) stop 2
+end