diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2014-04-14 13:33:23 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2014-04-14 13:33:23 +0000 |
commit | cb27986c9b5f270f880089d0bda74d10e76e8a3d (patch) | |
tree | c5328aef0529b219ce30c1e05f39197286ba85c8 /gcc/stor-layout.c | |
parent | 069fdd05da4e7abd6d6bd9415186f21b3cf14816 (diff) | |
download | gcc-cb27986c9b5f270f880089d0bda74d10e76e8a3d.zip gcc-cb27986c9b5f270f880089d0bda74d10e76e8a3d.tar.gz gcc-cb27986c9b5f270f880089d0bda74d10e76e8a3d.tar.bz2 |
stor-layout.c (place_field): Finalize non-constant offset for the field, if any.
* 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.
From-SVN: r209369
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 084d195..e3f8406 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. */ |