https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91661

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
The following patch fixes the ICE by forcing a simplification in the
declaration, but leads to regressions:

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (Revision 277460)
+++ gcc/fortran/decl.c  (Arbeitskopie)
@@ -2596,6 +2596,7 @@
              if (e->expr_type != EXPR_CONSTANT)
                {
                  n = gfc_copy_expr (e);
+                 gfc_resolve_expr (n);
                  gfc_simplify_expr (n, 1);
                  if (n->expr_type == EXPR_CONSTANT)
                    gfc_replace_expr (e, n);
@@ -2606,6 +2607,7 @@
              if (e->expr_type != EXPR_CONSTANT)
                {
                  n = gfc_copy_expr (e);
+                 gfc_resolve_expr (n);
                  gfc_simplify_expr (n, 1);
                  if (n->expr_type == EXPR_CONSTANT)
                    gfc_replace_expr (e, n);

The failing testcases are:

gfortran.dg/pr84734.f90
gfortran.dg/typebound_proc_32.f90

The first one misses the detection of an overflow.
The second one is a real negative side-effect I do not understand.

Reply via email to