From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1925B3858D1E; Fri, 11 Feb 2022 17:47:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1925B3858D1E From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102586] [12 Regression] ICE in clear_padding_type, at gimple-fold.c:4798 since r12-3433-ga25e0b5e6ac8a77a Date: Fri, 11 Feb 2022 17:47:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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: Fri, 11 Feb 2022 17:47:57 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102586 --- Comment #26 from Jakub Jelinek --- Though, I must say I don't understand how that works currently at all. For say struct C0 {}; struct C1 {}; struct C2 : C1, virtual C0 {}; struct C3 : virtual C2, C1 {}; struct C6 { char c; }; struct C7 : virtual C6, virtual C3, C1 {}; struct C8 : C7 {}; void bar (C8 *); void foo () { C8 c; bar (&c); } I see in gimple dump: c =3D .DEFERRED_INIT (32, 1, &"c"[0]); __builtin_clear_padding (&c, 0B, 1); C8::C8 (&c); bar (&c); and it does something only because C8::C8 doesn't get the -flifetime-dse=3D2 CLOBBER at the start. But if I do: struct C { char a; int b; char c; long d; C () : a (42), b (42), c (42), d = (42) {} }; void bar (C *); void foo () { C c; bar (&c); } then *.gimple is: c =3D .DEFERRED_INIT (24, 1, &"c"[0]); __builtin_clear_padding (&c, 0B, 1); C::C (&c); bar (&c); ... void C::C (struct C * const this) { *this =3D {CLOBBER}; { this->a =3D 42; this->b =3D 42; this->c =3D 42; this->d =3D 42; } } After einline this is: c =3D .DEFERRED_INIT (24, 1, &"c"[0]); MEM [(struct C *)&c + 1B] =3D {}; MEM [(struct C *)&c + 9B] =3D {}; c =3D{v} {CLOBBER}; c.a =3D 42; c.b =3D 42; c.c =3D 42; c.d =3D 42; bar (&c); and that keeps until dse1 which optimizes that out: c =3D{v} {CLOBBER}; c.a =3D 42; c.b =3D 42; c.c =3D 42; c.d =3D 42; bar (&c); so there is no zero padding initialization at all.=