From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [committed] testsuite: Change pr80334.C testcase to dg-do compile [PR102772]
Date: Wed, 30 Mar 2022 16:08:22 +0200 [thread overview]
Message-ID: <YkRkVtRrAUK63zxC@tucnak> (raw)
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
reply other threads:[~2022-03-30 14:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YkRkVtRrAUK63zxC@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).