[Bug fortran/92017] ICE in gfc_expr_attr, at fortran/primary.c:2674

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Oct 11 08:16:00 GMT 2019


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-10-11
                 CC|                            |burnus at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> Starting with gfortran-8

Which is not surprising as gfortran-7 rejects CHARACTER
to minloc/maxloc.


The problem is that the character length is missing:

The first argument to minloc/maxloc is named "array" in the Fortran
standard. And also in gfc_simplify_minmaxloc); there:
array->expr_type == EXPR_ARRAY and ts.type == BT_CHARACTER
but array->ts.u.cl == NULL – which causes the problem.


Looking at resolve.c's fixup_charlen(), that can be fixed by the following,
but my feeling is that it should be fixed earlier - as I am sure more locations
in simplify.c have the same issue.

--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -5427,4 +5427,7 @@ gfc_simplify_minmaxloc (gfc_expr *array, gfc_expr
     gcc_unreachable();

+  if (array->expr_type == EXPR_ARRAY && array->ts.type == BT_CHARACTER)
+    gfc_resolve_character_array_constructor  (array);
+
   extremum = gfc_get_constant_expr (array->ts.type, array->ts.kind,
&array->where);
   init_result_expr (extremum, init_val, array);


More information about the Gcc-bugs mailing list