diff options
author | Jason Merrill <merrill@gnu.org> | 1994-08-12 08:28:45 +0000 |
---|---|---|
committer | Jason Merrill <merrill@gnu.org> | 1994-08-12 08:28:45 +0000 |
commit | 7b9032dda340f9f36add9584b3e232ea49e6325d (patch) | |
tree | d5851b2216fcd993bf2acfb34c7ae3869b3b0081 /gcc | |
parent | 55e2b88efc7bb896ef7b6b164500c79e7ca727e6 (diff) | |
download | gcc-7b9032dda340f9f36add9584b3e232ea49e6325d.zip gcc-7b9032dda340f9f36add9584b3e232ea49e6325d.tar.gz gcc-7b9032dda340f9f36add9584b3e232ea49e6325d.tar.bz2 |
(expand_anon_union_decl): Fix up the alignment and mode
of the member VAR_DECLs.
From-SVN: r7899
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/stmt.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -3510,6 +3510,17 @@ expand_anon_union_decl (decl, cleanup, decl_elts) tree cleanup_elt = TREE_PURPOSE (decl_elts); enum machine_mode mode = TYPE_MODE (TREE_TYPE (decl_elt)); + /* Propagate the union's alignment to the elements. */ + DECL_ALIGN (decl_elt) = DECL_ALIGN (decl); + + /* If the element has BLKmode and the union doesn't, the union is + aligned such that the element doesn't need to have BLKmode, so + change the element's mode to the appropriate one for its size. */ + if (mode == BLKmode && DECL_MODE (decl) != BLKmode) + DECL_MODE (decl_elt) = mode + = mode_for_size (TREE_INT_CST_LOW (DECL_SIZE (decl_elt)), + MODE_INT, 1); + /* (SUBREG (MEM ...)) at RTL generation time is invalid, so we instead create a new MEM rtx with the proper mode. */ if (GET_CODE (x) == MEM) |