diff options
author | Richard Biener <rguenther@suse.de> | 2016-12-16 09:40:03 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-12-16 09:40:03 +0000 |
commit | b7fc43d7c747d190e197ca89cfce4f1d9def7c7e (patch) | |
tree | e7a4831ca7b46e08d1f5bc38c1d4f221aa7cfbbe /gcc/cp/cp-objcp-common.c | |
parent | c4d5c5e6ac73cac2b89d039eff9874ff80742589 (diff) | |
download | gcc-b7fc43d7c747d190e197ca89cfce4f1d9def7c7e.zip gcc-b7fc43d7c747d190e197ca89cfce4f1d9def7c7e.tar.gz gcc-b7fc43d7c747d190e197ca89cfce4f1d9def7c7e.tar.bz2 |
re PR c++/71694 (store-data race with bitfields and tail-padding in C++)
2016-12-16 Richard Biener <rguenther@suse.de>
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
Diffstat (limited to 'gcc/cp/cp-objcp-common.c')
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 633831c..b78d24d 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -252,6 +252,16 @@ cp_type_dwarf_attribute (const_tree type, int attr) return -1; } +/* Return the unit size of TYPE without reusable tail padding. */ + +tree +cp_unit_size_without_reusable_padding (tree type) +{ + if (CLASS_TYPE_P (type)) + return CLASSTYPE_SIZE_UNIT (type); + return TYPE_SIZE_UNIT (type); +} + /* Stubs to keep c-opts.c happy. */ void push_file_scope (void) |