From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 971F63856DCE; Thu, 21 Apr 2022 14:26:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 971F63856DCE From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/105310] ICE when UNION is after the 8th field in a DEC STRUCTURE with -finit-derived -finit-local-zero Date: Thu, 21 Apr 2022 14:26:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 7.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: foreese at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2022 14:26:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105310 --- Comment #4 from CVS Commits --- The releases/gcc-11 branch has been updated by Fritz Reese : https://gcc.gnu.org/g:15798c5d50f1318fcc0c0e7b0e71281f9a38433c commit r11-9922-g15798c5d50f1318fcc0c0e7b0e71281f9a38433c Author: Fritz Reese Date: Tue Apr 19 16:45:46 2022 -0400 fortran: Fix conv of UNION constructors [PR105310] This fixes an ICE when a UNION is the (1+8*2^n)-th field in a DEC STRUCTURE when compiled with -finit-derived -finit-local-zero. The problem was CONSTRUCTOR_APPEND_ELT from within gfc_conv_union_initializer modified the vector pointer, but the pointer was passed by-value, so the old pointer from the caller (gfc_conv_structure) pointed to freed memory. PR fortran/105310 gcc/fortran/ChangeLog: * trans-expr.c (gfc_conv_union_initializer): Pass vec* by reference. gcc/testsuite/ChangeLog: * gfortran.dg/dec_union_12.f90: New test. (cherry picked from commit c049f638da4f7b32b11e4d895184e0960bae5291)=