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 | |
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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 3 | ||||
-rw-r--r-- | gcc/stor-layout.c | 4 |
4 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 61e0e21..0bec304 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-04-14 Eric Botcazou <ebotcazou@adacore.com> + + * stor-layout.c (place_field): Finalize non-constant offset for the + field, if any. + 2014-04-14 Richard Biener <rguenther@suse.de> * tree-switch-conversion.c (lshift_cheap_p): Get speed_p diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b89bfec..a779988 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2014-04-14 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (create_field_decl_from): Finalize non-constant + offset for the field, if any. + 2014-04-09 Eric Botcazou <ebotcazou@adacore.com> Svante Signell <svante.signell@gmail.com> diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 4180e59..1e07693 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -8443,7 +8443,8 @@ create_field_decl_from (tree old_field, tree field_type, tree record_type, if (!new_pos) { normalize_offset (&pos, &bitpos, offset_align); - DECL_FIELD_OFFSET (new_field) = pos; + /* Finalize the position. */ + DECL_FIELD_OFFSET (new_field) = variable_size (pos); DECL_FIELD_BIT_OFFSET (new_field) = bitpos; SET_DECL_OFFSET_ALIGN (new_field, offset_align); DECL_SIZE (new_field) = size; 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. */ |