* [committed] testsuite: Change pr80334.C testcase to dg-do compile [PR102772]
@ 2022-03-30 14:08 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-03-30 14:08 UTC (permalink / raw)
To: gcc-patches
Hi!
The testcase has UB at runtime, placement new shouldn't construct
an object with certain alignment requirements into an unaligned buffer.
Discussed on IRC, tested on x86_64-linux -m32/-m64, committed to trunk.
2022-03-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/80334
PR target/102772
* g++.dg/torture/pr80334.C: Change from dg-do run to dg-do compile.
--- gcc/testsuite/g++.dg/torture/pr80334.C.jj 2020-01-12 11:54:37.268400509 +0100
+++ gcc/testsuite/g++.dg/torture/pr80334.C 2022-03-30 15:56:54.259507802 +0200
@@ -1,4 +1,8 @@
-// { dg-do run }
+// This used to be dg-do run testcase, but it is invalid at runtime:
+// trying to do a placement new of A which is 16-byte sized and aligned
+// into a 16-byte buffer at offset 17 bytes from 16-byte aligned address
+// is UB.
+// { dg-do compile }
struct A { alignas(16) char c; };
struct B { A unpacked; char d; } __attribute__((packed));
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-30 14:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 14:08 [committed] testsuite: Change pr80334.C testcase to dg-do compile [PR102772] Jakub Jelinek
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).