summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-04-21 17:06:31 +0200
committerJakub Jelinek <jakub@redhat.com>2020-04-21 17:06:31 +0200
commit73f8e9dca5ff891ed19001b213fd1f6ce31417e3 (patch)
tree672bb597baac2acd957524d5f12db22395dbf327 /gcc/testsuite/c-c++-common
parent08d6ec14e654292340ccc6aa5612bbd91d4d57e8 (diff)
ubsan: Avoid -Wpadded warnings [PR94641]
-Wpadded warnings aren't really useful for the artificial types that GCC lays out for ubsan. 2020-04-21 Jakub Jelinek <jakub@redhat.com> PR c/94641 * stor-layout.c (place_field, finalize_record_size): Don't emit -Wpadded warning on TYPE_ARTIFICIAL rli->t. * ubsan.c (ubsan_get_type_descriptor_type, ubsan_get_source_location_type, ubsan_create_data): Set TYPE_ARTIFICIAL. * asan.c (asan_global_struct): Likewise. * c-c++-common/ubsan/pr94641.c: New test.
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr94641.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr94641.c b/gcc/testsuite/c-c++-common/ubsan/pr94641.c
new file mode 100644
index 00000000000..b41cb06164d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr94641.c
@@ -0,0 +1,11 @@
+/* PR c/94641 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -Wpadded" } */
+
+void foo (void *) __attribute__((nonnull));
+
+void
+bar (void *p)
+{
+ foo (p);
+}