[Bug fortran/97896] [11/12 Regression] ICE in gfc_trans_assignment_1, at fortran/trans-expr.c:11156

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 16 20:36:18 GMT 2021


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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Mikael Morin
<mikael@gcc.gnu.org>:

https://gcc.gnu.org/g:92e549683e1f46ba419e40b12928dc8afe5dc967

commit r11-9243-g92e549683e1f46ba419e40b12928dc8afe5dc967
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sun Nov 7 14:39:18 2021 +0100

    fortran: Ignore unused args in scalarization [PR97896]

    The KIND argument of the INDEX intrinsic is a compile time constant
    that is used at compile time only to resolve to a kind-specific library
    function.  That argument is otherwise completely ignored at runtime, and
there is
    no code generated for it as the library procedure has no kind argument.
    This confuses the scalarizer which expects to see every argument
    of elemental functions used when calling a procedure.
    This change removes the argument from the scalarization lists
    at the beginning of the scalarization process, so that the argument
    is completely ignored.
    This also reverts the existing workaround
    (commit d09847357b965a2c2cda063827ce362d4c9c86f2 except for its testcase).

            PR fortran/97896

    gcc/fortran/ChangeLog:
            * intrinsic.c (add_sym_4ind): Remove.
            (add_functions): Use add_sym4 instead of add_sym4ind.
            Donât special case the index intrinsic.
            * iresolve.c (gfc_resolve_index_func): Use the individual arguments
            directly instead of the full argument list.
            * intrinsic.h (gfc_resolve_index_func): Update the declaration
            accordingly.
            * trans-decl.c (gfc_get_extern_function_decl): Donât modify the
            list of arguments in the case of the index intrinsic.
            * trans-array.h (gfc_get_intrinsic_for_expr,
            gfc_get_proc_ifc_for_expr): New.
            * trans-array.c (gfc_get_intrinsic_for_expr,
            arg_evaluated_for_scalarization): New.
            (gfc_walk_elemental_function_args): Add intrinsic procedure
            as argument.  Count arguments.  Check
arg_evaluated_for_scalarization.
            * trans-intrinsic.c (gfc_walk_intrinsic_function): Update call.
            * trans-stmt.c (get_intrinsic_for_code): New.
            (gfc_trans_call): Update call.

    gcc/testsuite/ChangeLog:
            * gfortran.dg/index_5.f90: New.

    (cherry picked from commit 68d62cb20637b2faf2c2cc1716a0786b07a6a76f)


More information about the Gcc-bugs mailing list