+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.
+
2020-04-21 Duan bo <duanbo3@huawei.com>
PR target/94577
TYPE_FIELDS (ret) = fields[0];
TYPE_NAME (ret) = type_decl;
TYPE_STUB_DECL (ret) = type_decl;
+ TYPE_ARTIFICIAL (ret) = 1;
layout_type (ret);
return ret;
}
Bump the cumulative size to multiple of field alignment. */
if (!targetm.ms_bitfield_layout_p (rli->t)
- && DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION)
+ && DECL_SOURCE_LOCATION (field) != BUILTINS_LOCATION
+ && !TYPE_ARTIFICIAL (rli->t))
warning (OPT_Wpadded, "padding struct to align %q+D", field);
/* If the alignment is still within offset_align, just align
if (TREE_CONSTANT (unpadded_size)
&& simple_cst_equal (unpadded_size, TYPE_SIZE (rli->t)) == 0
- && input_location != BUILTINS_LOCATION)
+ && input_location != BUILTINS_LOCATION
+ && !TYPE_ARTIFICIAL (rli->t))
warning (OPT_Wpadded, "padding struct size to alignment boundary");
if (warn_packed && TREE_CODE (rli->t) == RECORD_TYPE
+2020-04-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/94641
+ * c-c++-common/ubsan/pr94641.c: New test.
+
2020-04-21 Patrick Palka <ppalka@redhat.com>
PR c++/94597
--- /dev/null
+/* PR c/94641 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -Wpadded" } */
+
+void foo (void *) __attribute__((nonnull));
+
+void
+bar (void *p)
+{
+ foo (p);
+}
TYPE_FIELDS (ret) = fields[0];
TYPE_NAME (ret) = type_decl;
TYPE_STUB_DECL (ret) = type_decl;
+ TYPE_ARTIFICIAL (ret) = 1;
layout_type (ret);
ubsan_type_descriptor_type = ret;
return ret;
TYPE_FIELDS (ret) = fields[0];
TYPE_NAME (ret) = type_decl;
TYPE_STUB_DECL (ret) = type_decl;
+ TYPE_ARTIFICIAL (ret) = 1;
layout_type (ret);
ubsan_source_location_type = ret;
return ret;
TYPE_FIELDS (ret) = fields[0];
TYPE_NAME (ret) = type_decl;
TYPE_STUB_DECL (ret) = type_decl;
+ TYPE_ARTIFICIAL (ret) = 1;
layout_type (ret);
/* Now, fill in the type. */