public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98104] New: [11 regression] -Wplacement-new false positive (struture padding?)
@ 2020-12-02 19:03 sss@li-snyder.org
2020-12-02 19:19 ` [Bug c++/98104] " jakub at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: sss@li-snyder.org @ 2020-12-02 19:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98104
Bug ID: 98104
Summary: [11 regression] -Wplacement-new false positive
(struture padding?)
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sss@li-snyder.org
Target Milestone: ---
hi -
With gcc 11 (20201128), the following source (reduced from eigen 3.3.7)
gives a warning:
-- x.cc ---------------------------------------------------------
#include <new>
class Base
{
public:
Base();
int* a;
char b;
};
class Der : public Base {};
void baz()
{
Der der;
::new (static_cast<Base*>(&der)) Base;
}
-----------------------------------------------------------------
$ g++ -c x.cc
x.cc: In function ‘void baz()’:
x.cc:16:10: warning: placement new constructing an object of type ‘Base’ and
size ‘16’ in a region of type ‘Base’ and size ‘9’ [-Wplacement-new=]
16 | ::new (static_cast<Base*>(&der)) Base;
| ^~~~~~~~~~~~~~~~~~~~~~~~
x.cc:11:7: note: ‘Der::<anonymous>’ declared here
11 | class Der : public Base {};
| ^~~
This appears to be a false positive, possibly due to handling
of padding at the end of the structure.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98104] [11 regression] -Wplacement-new false positive (struture padding?)
2020-12-02 19:03 [Bug c++/98104] New: [11 regression] -Wplacement-new false positive (struture padding?) sss@li-snyder.org
@ 2020-12-02 19:19 ` jakub at gcc dot gnu.org
2020-12-03 7:21 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-12-02 19:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98104
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think this has been fixed with
r11-5628-gb76f83e3859f738809d3aa8bd9dc14e10fc40e24
Might be useful to add the testcase into the testsuite though.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98104] [11 regression] -Wplacement-new false positive (struture padding?)
2020-12-02 19:03 [Bug c++/98104] New: [11 regression] -Wplacement-new false positive (struture padding?) sss@li-snyder.org
2020-12-02 19:19 ` [Bug c++/98104] " jakub at gcc dot gnu.org
@ 2020-12-03 7:21 ` rguenth at gcc dot gnu.org
2020-12-03 9:05 ` cvs-commit at gcc dot gnu.org
2020-12-03 9:07 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-03 7:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98104
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98104] [11 regression] -Wplacement-new false positive (struture padding?)
2020-12-02 19:03 [Bug c++/98104] New: [11 regression] -Wplacement-new false positive (struture padding?) sss@li-snyder.org
2020-12-02 19:19 ` [Bug c++/98104] " jakub at gcc dot gnu.org
2020-12-03 7:21 ` rguenth at gcc dot gnu.org
@ 2020-12-03 9:05 ` cvs-commit at gcc dot gnu.org
2020-12-03 9:07 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-03 9:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98104
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:381d1d0120e4dfab3a714f44354e868a80dbaa25
commit r11-5698-g381d1d0120e4dfab3a714f44354e868a80dbaa25
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Dec 3 10:02:02 2020 +0100
testsuite: Add testcase for already fixed PR [PR98104]
This testcase got broken with r11-3826 and got fixed with r11-5628.
2020-12-03 Jakub Jelinek <jakub@redhat.com>
PR c++/98104
* g++.dg/warn/pr98104.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/98104] [11 regression] -Wplacement-new false positive (struture padding?)
2020-12-02 19:03 [Bug c++/98104] New: [11 regression] -Wplacement-new false positive (struture padding?) sss@li-snyder.org
` (2 preceding siblings ...)
2020-12-03 9:05 ` cvs-commit at gcc dot gnu.org
@ 2020-12-03 9:07 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-12-03 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98104
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase installed, the underlying issue is fixed, closing.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-03 9:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 19:03 [Bug c++/98104] New: [11 regression] -Wplacement-new false positive (struture padding?) sss@li-snyder.org
2020-12-02 19:19 ` [Bug c++/98104] " jakub at gcc dot gnu.org
2020-12-03 7:21 ` rguenth at gcc dot gnu.org
2020-12-03 9:05 ` cvs-commit at gcc dot gnu.org
2020-12-03 9:07 ` jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).