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

--- Comment #7 from José Rui Faustino de Sousa <jrfsousa at gcc dot gnu.org> ---
I was using pr87993.f90 from the testsuite... ;-)

The fix is simple enough:

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index a37ad66..a9518e7 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -7138,8 +7138,10 @@ gfc_resolve_expr (gfc_expr *e)
       /* Also try to expand a constructor.  */
       if (t)
        {
+         gfc_simplify_expr(e, 1);
          gfc_expression_rank (e);
-         if (gfc_is_constant_expr (e) || gfc_is_expandable_expr (e))
+         if (e->expr_type == EXPR_ARRAY
+             && (gfc_is_constant_expr (e) || gfc_is_expandable_expr (e)))
            gfc_expand_constructor (e, false);
        }

I really should have though of this possibility...

Thank you very much.

Best regards,
José Rui

Reply via email to