From d324678b145b16cd2ffa513c5ea5b56104289426 Mon Sep 17 00:00:00 2001 From: kenner Date: Wed, 18 Jan 1995 12:43:31 +0000 Subject: [PATCH] (get_inner_reference): Don't ignore CONVERT_EXPR from non-UNION_TYPE to UNION_TYPE. (expand_expr, case CONVERT_EXPR): Check for conversion to union before checking for not changing mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8772 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/expr.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/gcc/expr.c b/gcc/expr.c index 8e75dddcfac..785e74294e1 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -3581,6 +3581,9 @@ get_inner_reference (exp, pbitsize, pbitpos, poffset, pmode, else if (TREE_CODE (exp) != NON_LVALUE_EXPR && ! ((TREE_CODE (exp) == NOP_EXPR || TREE_CODE (exp) == CONVERT_EXPR) + && ! (TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE + && (TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) + != UNION_TYPE)) && (TYPE_MODE (TREE_TYPE (exp)) == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))) break; @@ -4981,21 +4984,6 @@ expand_expr (exp, target, tmode, modifier) case NOP_EXPR: case CONVERT_EXPR: case REFERENCE_EXPR: - if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))) - { - op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, - modifier); - - /* If the signedness of the conversion differs and OP0 is - a promoted SUBREG, clear that indication since we now - have to do the proper extension. */ - if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))) != unsignedp - && GET_CODE (op0) == SUBREG) - SUBREG_PROMOTED_VAR_P (op0) = 0; - - return op0; - } - if (TREE_CODE (type) == UNION_TYPE) { tree valtype = TREE_TYPE (TREE_OPERAND (exp, 0)); @@ -5034,6 +5022,21 @@ expand_expr (exp, target, tmode, modifier) return target; } + if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))) + { + op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, + modifier); + + /* If the signedness of the conversion differs and OP0 is + a promoted SUBREG, clear that indication since we now + have to do the proper extension. */ + if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))) != unsignedp + && GET_CODE (op0) == SUBREG) + SUBREG_PROMOTED_VAR_P (op0) = 0; + + return op0; + } + op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, 0); if (GET_MODE (op0) == mode) return op0; -- 2.11.4.GIT