[gcc/devel/omp/gcc-9] re PR fortran/91553 (ICE in gfc_real2complex, at fortran/arith.c:2208)

Tobias Burnus burnus@gcc.gnu.org
Thu Mar 5 14:02:00 GMT 2020


https://gcc.gnu.org/g:f97453cb2025279a0cd26d8c05c94a3dc437d702

commit f97453cb2025279a0cd26d8c05c94a3dc437d702
Author: Steven G. Kargl <kargl@gcc.gnu.org>
Date:   Sat Sep 14 17:05:17 2019 +0000

    re PR fortran/91553 (ICE in gfc_real2complex, at fortran/arith.c:2208)
    
    2019-09-14  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-14  Steven G. Kargl  <kargl@gcc.gnu.org>
    
    	PR fortran/91553
    	* gfortran.dg/pr91553.f90: New test.
    
    From-SVN: r275716

Diff:
---
 gcc/fortran/ChangeLog                 | 6 ++++++
 gcc/fortran/simplify.c                | 6 ++++++
 gcc/testsuite/ChangeLog               | 5 +++++
 gcc/testsuite/gfortran.dg/pr91553.f90 | 8 ++++++++
 4 files changed, 25 insertions(+)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d07ad30..19a3e0c 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
 2019-09-14  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-14  Steven G. Kargl  <kargl@gcc.gnu.org>
+
 	PR fortran/91566
 	* simplify.c (gfc_simplify_merge): Need to simplify expression
 	after insertation of parenthesis.
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 30924c1..f8c9a42 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -8526,6 +8526,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);
 	    }
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 38a5990..0df33c2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2019-09-14  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+	PR fortran/91553
+	* gfortran.dg/pr91553.f90: New test.
+
+2019-09-14  Steven G. Kargl  <kargl@gcc.gnu.org>
+
 	PR fortran/91566
 	* gfortran.dg/pr91566.f90: New test.
 
diff --git a/gcc/testsuite/gfortran.dg/pr91553.f90 b/gcc/testsuite/gfortran.dg/pr91553.f90
new file mode 100644
index 0000000..2d0b018
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr91553.f90
@@ -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



More information about the Gcc-cvs mailing list