diff mbox series

[committed] testsuite: Change pr80334.C testcase to dg-do compile [PR102772]

Message ID YkRkVtRrAUK63zxC@tucnak
State New
Headers show
Series [committed] testsuite: Change pr80334.C testcase to dg-do compile [PR102772] | expand

Commit Message

Jakub Jelinek March 30, 2022, 2:08 p.m. UTC
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.



	Jakub
diff mbox series

Patch

--- 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));