From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 625903858D3C; Thu, 25 May 2023 18:24:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 625903858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685039046; bh=x42DHTIlGn7urKNAVr+TKSdcCWOxQBglAlip4Lgjw/Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RdMzyFbzc9T51KRnzs0e+6fOEb/HUuw09uuYbJDOSlAZ6U/std/ovGTCxHN0BIgVP lzCsZlcdEPtcFMsYSj5YVpjpKjsKl0t7GCsKGXZBT5jtd3+JaQqUYRUokt8/2kV2Fc SONHC9jYgiGwPhkHCvEub5M5muP1ADPvsUPw+ESs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109801] -Wmaybe-uninitialized warning with -O1 on move constructor Date: Thu, 25 May 2023 18:24:06 +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.1.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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=3D109801 --- Comment #5 from Andrew Pinski --- (In reply to Scott Zhong from comment #4) > The move constructor "steals" resources rather than make copies of them, = and > leave the argument in some valid but otherwise indeterminate state. It is > reasonable that size_ is not initialized in the context of a move > constructor. >=20 > If you define body to the constructor and destructor for the class list, = the > warning goes away, which has nothing to do with size_ being initialized or > not. >=20 > template > class list > { > public: > list() {} > ~list() {} > }; Because if you don't have the define then the calls might clobber some other memory ...=