From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B61A1385803F; Sat, 1 May 2021 11:54:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B61A1385803F From: "foldy at rmki dot kfki.hu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100370] New: [11.1.0 regression] Incorrect warning for placement new Date: Sat, 01 May 2021 11:54:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: foldy at rmki dot kfki.hu X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Sat, 01 May 2021 11:54:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100370 Bug ID: 100370 Summary: [11.1.0 regression] Incorrect warning for placement new Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: foldy at rmki dot kfki.hu Target Milestone: --- With g++ 11.1.0: tmp> cat test.cc #include int main() { struct s1 { int iv[4]; }; struct s2 { union { char* cp; int* ip; }; }; s2 b; b.ip=3Dnew int[8]; new (b.ip+4) s1; } tmp> g++ -c test.cc test.cc: In function 'int main()': test.cc:10:12: warning: placement new constructing an object of type 'main()::s1' and size '16' in a region of type 'main()::s2' and size '0' [-Wplacement-new=3D] 10 | new (b.ip+4) s1; | ~~~~^~ test.cc:8:6: note: at offset 16 from 'b' declared here 8 | s2 b; | ^ g++ 10.2.1 is OK.=