[Bug fortran/92017] ICE in gfc_expr_attr, at fortran/primary.c:2674
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92017 Thomas Koenig changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #3 from Thomas Koenig --- Fixed on trunk, can be backported upon request.
[Bug fortran/92017] ICE in gfc_expr_attr, at fortran/primary.c:2674
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92017 --- Comment #2 from Thomas Koenig --- Author: tkoenig Date: Sun Oct 13 13:42:30 2019 New Revision: 276938 URL: https://gcc.gnu.org/viewcvs?rev=276938&root=gcc&view=rev Log: 2019-10-13 Thomas Koenig PR fortran/92017 * expr.c (simplify_parameter_variable): Set the character length of the result expression from the original expression if necessary. 2019-10-13 Thomas Koenig PR fortran/92017 * gfortran.dg/minmaxloc_14.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/minmaxloc_14.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/expr.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/92017] ICE in gfc_expr_attr, at fortran/primary.c:2674
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92017 Thomas Koenig changed: What|Removed |Added Status|NEW |ASSIGNED CC||tkoenig at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |tkoenig at gcc dot gnu.org
[Bug fortran/92017] ICE in gfc_expr_attr, at fortran/primary.c:2674
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92017 Tobias Burnus 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 --- > 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);