From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5F7DD3857400; Fri, 8 Mar 2024 14:30:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F7DD3857400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709908215; bh=+rplwfW13fQ/aiHPd2cm5DDtyKtZjdaczqPAQ+ktwZ0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=O5md78jHIEKMPC5fEvDSH8ws9cIV0wrd60KGjaaMrcO51yeqivjf+ZADrgJATAO71 jGL/whA0vNwxKEeIU+4368fsUAsVYEz7+t8YWP+E4RPDpilkkjJo8d4SnfktnlBZ0d l66IVREePUUypjZeQM/vN04C4X05YTM1fxwyZJHc= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112307] Segmentation fault with -O1 -fcode-hoisting Date: Fri, 08 Mar 2024 14:30:14 +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: 14.0 X-Bugzilla-Keywords: needs-reduction, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112307 --- Comment #8 from Jonathan Wakely --- I explained this in PR 109945 comment 25 There is no guaranteed copy elision for objects with a trivial copy constru= ctor and trivial (or deleted) destructor. The compiler is allowed to make tempor= ary copies, to allow passing the object in registers (which has been what the A= BI requires for decades longer than the guaranteed copy elision rules have existed). If you want to have self-referential pointers in your object then you need = to ensure copies really are elided. And so it should not be trivially copyable, because that removes the guarantee of copy elision.=