public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100370] New: [11.1.0 regression] Incorrect warning for placement new
@ 2021-05-01 11:54 foldy at rmki dot kfki.hu
  2021-05-03  7:57 ` [Bug c++/100370] [11/12 Regression] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: foldy at rmki dot kfki.hu @ 2021-05-01 11:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100370

            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 <new>

int main()
{
  struct s1 { int iv[4]; };
  struct s2 { union { char* cp; int* ip; }; };

  s2 b;
  b.ip=new 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=]
   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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-29 10:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-01 11:54 [Bug c++/100370] New: [11.1.0 regression] Incorrect warning for placement new foldy at rmki dot kfki.hu
2021-05-03  7:57 ` [Bug c++/100370] [11/12 Regression] " rguenth at gcc dot gnu.org
2021-05-03 16:48 ` msebor at gcc dot gnu.org
2021-07-28  7:06 ` [Bug c++/100370] [11/12 Regression] Incorrect -Wplacement-new with union rguenth at gcc dot gnu.org
2022-01-20 13:57 ` rguenth at gcc dot gnu.org
2022-04-06 12:14 ` jason at gcc dot gnu.org
2022-04-07  1:29 ` jason at gcc dot gnu.org
2022-04-11 12:38 ` cvs-commit at gcc dot gnu.org
2022-04-21  7:49 ` [Bug c++/100370] [11 " rguenth at gcc dot gnu.org
2023-05-29 10:04 ` 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).