From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D0E813858D37; Tue, 23 May 2023 19:38:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0E813858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684870734; bh=FKnzVtz2yQk4TFlmwvBtAuVOpT9bhogEOKoubJeJloM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iYnY/JNIjHH1JyPPibGuG0s1jd9KAdupEbTVG3ms2imOmBvq5u+t7825k8Issy6yq z5Auxy0cUlYcLpRK/N4FWXgOPVpORe+Rcv4WEycFZwxPFz9hi/+L8ecPwDmf3qHJZf 0FGQDn24vW+wuYSjZGgzUfKCIEpCGqfnRds7gETY= From: "arthur.j.odwyer at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109945] Escape analysis hates copy elision: different result with -O1 vs -O2 Date: Tue, 23 May 2023 19:38:53 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: arthur.j.odwyer at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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=3D109945 --- Comment #11 from Arthur O'Dwyer --- (In reply to Andrew Pinski from comment #8) > (In reply to Arthur O'Dwyer from comment #7) > > // https://godbolt.org/z/Ea43Y65z4 > > struct Widget { > > int i =3D 1; > ... > > In this case, Widget has no constructors, >=20 > No, it has a constructor because of the NSDMI. NSDMI causes a non-trivial > constexpr constructor to be created. Fair. I meant Widget has no _program-defined_ constructors (such as would h= ave unknown effects and might invisibly-to-the-compiler escape a copy of `&w`).= I might still be using the wrong term. But you found a better example without that wrinkle, anyway. :)=