This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Bug in handling of offset_align
- To: gcc-patches at gcc dot gnu dot org
- Subject: Bug in handling of offset_align
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Wed, 19 Apr 00 12:20:30 EDT
The following fixes a bug where fields after a variable-length field were't
being properly aligned.
Wed Apr 19 12:14:55 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* stor-layout.c (place_field): Set rli->offset_align properly.
*** stor-layout.c 2000/04/14 11:51:36 1.66
--- stor-layout.c 2000/04/19 15:55:49
*************** place_field (rli, field)
*** 754,757 ****
--- 754,760 ----
}
+ if (! TREE_CONSTANT (rli->offset))
+ rli->offset_align = desired_align;
+
}
*************** place_field (rli, field)
*** 822,828 ****
#endif
- if (! TREE_CONSTANT (rli->offset))
- rli->offset_align = DECL_ALIGN (field);
-
/* Offset so far becomes the position of this field after normalizing. */
normalize_rli (rli);
--- 825,828 ----
*************** place_field (rli, field)
*** 867,870 ****
--- 867,871 ----
= size_binop (PLUS_EXPR, rli->offset, DECL_SIZE_UNIT (field));
rli->bitpos = bitsize_zero_node;
+ rli->offset_align = MIN (rli->offset_align, DECL_ALIGN (field));
}
else