This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] expand_expr EXPAND_NORMAL modifer when recursing (PR middle-end/29250)
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 13 Oct 2006 13:49:40 -0400
- Subject: [PATCH] expand_expr EXPAND_NORMAL modifer when recursing (PR middle-end/29250)
When expanding an INDIRECT_REF, GCC invokes expand_expr with
modifier EXPAND_SUM, allowing a PLUS or MULT in the RTL handed to
memory_address, which handles validation. However, this same modifier
currently is passed to recursive expand_expr calls for interior
expressions. This can lead to generation of invalid RTL. For the case of
the PR, expansion travels down a path that does no validation or predicate
checking and eventually creates raw RTL representing the expression.
Through discussions with Ian, he and I created the appended patch
that intercepts EXPAND_SUM modifier at CONVERT_EXPR and NOP_EXPR and
recurses with the modifier changed to EXPAND_NORMAL.
Bootstrapped and regression tested on powerpc-ibm-aix5.2.0.0.
Okay for mainline?
Thanks, David
: ADDPATCH middle-end :
2006-10-13 David Edelsohn <edelsohn@gnu.org>
Ian Lance Taylor <ian@airs.com>
PR middle-end/29250
* expr.c (expand_expr_real_1) <NON_LVALUE_EXPR, NOP_EXPR,
CONVERT_EXPR>: Change EXPAND_SUM modifier to EXPAND_NORMAL when
recursing.
Index: expr.c
===================================================================
*** expr.c (revision 117682)
--- expr.c (working copy)
*************** expand_expr_real_1 (tree exp, rtx target
*** 7739,7745 ****
return REDUCE_BIT_FIELD (op0);
}
! op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier);
if (GET_MODE (op0) == mode)
;
--- 7739,7746 ----
return REDUCE_BIT_FIELD (op0);
}
! op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode,
! modifier == EXPAND_SUM ? EXPAND_NORMAL : modifier);
if (GET_MODE (op0) == mode)
;