summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-14 13:33:23 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-14 13:33:23 +0000
commit46515aebd45b1274addf517d836a08b51c8f01c7 (patch)
treec5328aef0529b219ce30c1e05f39197286ba85c8 /gcc/stor-layout.c
parent0c1e966f1c29995cace171cc4171658738d6309f (diff)
downloadgcc-46515aebd45b1274addf517d836a08b51c8f01c7.tar.gz
* stor-layout.c (place_field): Finalize non-constant offset for the
field, if any. ada/ * gcc-interface/decl.c (create_field_decl_from): Finalize non-constant offset for the field, if any. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209369 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 084d195cd48..e3f8406626b 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1417,6 +1417,10 @@ place_field (record_layout_info rli, tree field)
DECL_FIELD_BIT_OFFSET (field) = rli->bitpos;
SET_DECL_OFFSET_ALIGN (field, rli->offset_align);
+ /* Evaluate nonconstant offsets only once, either now or as soon as safe. */
+ if (TREE_CODE (DECL_FIELD_OFFSET (field)) != INTEGER_CST)
+ DECL_FIELD_OFFSET (field) = variable_size (DECL_FIELD_OFFSET (field));
+
/* If this field ended up more aligned than we thought it would be (we
approximate this by seeing if its position changed), lay out the field
again; perhaps we can use an integral mode for it now. */