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

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

https://gcc.gnu.org/g:3b0f715744d7919ee729d370155a68d5fa97cba9

commit r11-9804-g3b0f715744d7919ee729d370155a68d5fa97cba9
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Fri Jan 28 22:00:57 2022 +0100

    fortran: Unshare associate var charlen [PR104228]

    PR104228 showed that character lengths were shared between associate
    variable and associate targets.  This is problematic when the associate
    target is itself a variable and gets a variable to hold the length, as
    the length variable is added (and all the variables following it in the
chain)
    to both the associate variable scope and the target variable scope.
    This caused an ICE when compiling with -O0 -fsanitize=address.

    This change forces the creation of a separate character length for the
    associate variable.  It also forces the initialization of the character
    length variable to avoid regressing associate_32 and associate_47 tests.

            PR fortran/104228

    gcc/fortran/ChangeLog:

            * resolve.c (resolve_assoc_var): Also create a new character
            length for non-dummy associate targets.
            * trans-stmt.c (trans_associate_var): Initialize character length
            even if no temporary is used for the associate variable.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/asan/associate_58.f90: New test.
            * gfortran.dg/asan/associate_59.f90: New test.

    (cherry picked from commit 57da34939703a6e6d3267a0d25d1fb9369d3ac0e)

Reply via email to