From: Jason Merrill Date: Fri, 12 Aug 1994 08:28:45 +0000 (+0000) Subject: (expand_anon_union_decl): Fix up the alignment and mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b9032dda340f9f36add9584b3e232ea49e6325d;p=gcc.git (expand_anon_union_decl): Fix up the alignment and mode of the member VAR_DECLs. From-SVN: r7899 --- diff --git a/gcc/stmt.c b/gcc/stmt.c index 40698295f3a..01228734d69 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -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)