aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-10-01 21:23:04 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-10-01 21:23:04 -0400
commitb74f5ff2bd0793d863acf42138a5547ee59dde51 (patch)
tree9c7c0aef3245256b621b7400c0e872d0a92d0fa0 /gcc
parentf29369b9f2b1d1d7bc55ba044076860b7a636231 (diff)
downloadgcc-b74f5ff2bd0793d863acf42138a5547ee59dde51.zip
gcc-b74f5ff2bd0793d863acf42138a5547ee59dde51.tar.gz
gcc-b74f5ff2bd0793d863acf42138a5547ee59dde51.tar.bz2
(expand_expr, case COMPONENT_REF): If getting component of union of
variable size, propagate TARGET. From-SVN: r10415
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index a1fda98..d2de924 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -4762,8 +4762,18 @@ expand_expr (exp, target, tmode, modifier)
/* In some cases, we will be offsetting OP0's address by a constant.
So get it as a sum, if possible. If we will be using it
- directly in an insn, we validate it. */
- op0 = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_SUM);
+ directly in an insn, we validate it.
+
+ If TEM's type is a union of variable size, pass TARGET to the inner
+ computation, since it will need a temporary and TARGET is known
+ to have to do. This occurs in unchecked conversion in Ada. */
+
+ op0 = expand_expr (tem,
+ (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE
+ && (TREE_CODE (TYPE_SIZE (TREE_TYPE (tem)))
+ != INTEGER_CST)
+ ? target : NULL_RTX),
+ VOIDmode, EXPAND_SUM);
/* If this is a constant, put it into a register if it is a
legitimate constant and memory if it isn't. */