From b7fc43d7c747d190e197ca89cfce4f1d9def7c7e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 16 Dec 2016 09:40:03 +0000 Subject: re PR c++/71694 (store-data race with bitfields and tail-padding in C++) 2016-12-16 Richard Biener PR c++/71694 * langhooks-def.h (lhd_unit_size_without_reusable_padding): Declare. (LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Adjust. * langhooks.h (struct lang_hooks_for_types): Add unit_size_without_reusable_padding. * langhooks.c (lhd_unit_size_without_reusable_padding): New. * stor-layout.c (finish_bitfield_representative): Use unit_size_without_reusable_padding langhook to decide on the last representatives size. cp/ * cp-objcp-common.h (cp_unit_size_without_reusable_padding): Declare. (LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING): Define. * cp-objcp-common.c (cp_unit_size_without_reusable_padding): New. * g++.dg/pr71694.C: New testcase. From-SVN: r243738 --- gcc/langhooks.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/langhooks.c') diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 1ce1962..260d33c 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -729,6 +729,15 @@ lhd_type_dwarf_attribute (const_tree, int) return -1; } +/* Default implementation of LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING. + Just return TYPE_SIZE_UNIT unadjusted. */ + +tree +lhd_unit_size_without_reusable_padding (tree t) +{ + return TYPE_SIZE_UNIT (t); +} + /* Returns true if the current lang_hooks represents the GNU C frontend. */ bool -- cgit v1.1