This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
SOme bugfixes in expr.c
- To: gcc-patches at gcc dot gnu dot org
- Subject: SOme bugfixes in expr.c
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Sat, 27 Oct 01 17:51:45 EDT
These are fixes to some regressions caused by my changes in the last
few weeks plus a performance issue I noticed in safe_from_p.
Tested on alphaev56-dec-osf4.0c.
Sat Oct 27 17:32:04 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (stor_constructor_field): Always call adjust_address.
Copy TARGET before changing its alias set.
(store_field): Likewise, for TO_RTX.
(get_inner_reference): Stop at PLACEHOLDER_EXPR if can't find
replacement.
(safe_from_p, case ADDR_EXPR): Properly check for conflict.
(find_placeholder): Return 0 if can't find object.
(expand_expr, case PLACEHOLDER_EXPR): Abort if find_placeholder
returns 0.
*** expr.c 2001/10/25 12:55:16 1.365
--- expr.c 2001/10/27 21:21:44
*************** store_constructor_field (target, bitsize
*** 4473,4483 ****
&& (bitpos == 0 || GET_CODE (target) == MEM))
{
! if (bitpos != 0)
! target
! = adjust_address (target,
! GET_MODE (target) == BLKmode
! || 0 != (bitpos
! % GET_MODE_ALIGNMENT (GET_MODE (target)))
! ? BLKmode : VOIDmode, bitpos / BITS_PER_UNIT);
--- 4473,4482 ----
&& (bitpos == 0 || GET_CODE (target) == MEM))
{
! target
! = adjust_address (target,
! GET_MODE (target) == BLKmode
! || 0 != (bitpos
! % GET_MODE_ALIGNMENT (GET_MODE (target)))
! ? BLKmode : VOIDmode, bitpos / BITS_PER_UNIT);
*************** store_constructor_field (target, bitsize
*** 4489,4493 ****
if (GET_CODE (target) == MEM && ! MEM_KEEP_ALIAS_SET_P (target)
&& MEM_ALIAS_SET (target) != 0)
! set_mem_alias_set (target, alias_set);
store_constructor (exp, target, align, cleared, bitsize / BITS_PER_UNIT);
--- 4488,4495 ----
if (GET_CODE (target) == MEM && ! MEM_KEEP_ALIAS_SET_P (target)
&& MEM_ALIAS_SET (target) != 0)
! {
! target = copy_rtx (target);
! set_mem_alias_set (target, alias_set);
! }
store_constructor (exp, target, align, cleared, bitsize / BITS_PER_UNIT);
*************** store_field (target, bitsize, bitpos, mo
*** 5355,5359 ****
MEM_SET_IN_STRUCT_P (to_rtx, 1);
if (!MEM_KEEP_ALIAS_SET_P (to_rtx) && MEM_ALIAS_SET (to_rtx) != 0)
! set_mem_alias_set (to_rtx, alias_set);
return store_expr (exp, to_rtx, value_mode != VOIDmode);
--- 5357,5364 ----
MEM_SET_IN_STRUCT_P (to_rtx, 1);
if (!MEM_KEEP_ALIAS_SET_P (to_rtx) && MEM_ALIAS_SET (to_rtx) != 0)
! {
! to_rtx = copy_rtx (to_rtx);
! set_mem_alias_set (to_rtx, alias_set);
! }
return store_expr (exp, to_rtx, value_mode != VOIDmode);
*************** get_inner_reference (exp, pbitsize, pbit
*** 5503,5507 ****
else if (TREE_CODE (exp) == PLACEHOLDER_EXPR)
{
! exp = find_placeholder (exp, &placeholder_ptr);
continue;
}
--- 5508,5521 ----
else if (TREE_CODE (exp) == PLACEHOLDER_EXPR)
{
! tree new = find_placeholder (exp, &placeholder_ptr);
!
! /* If we couldn't find the replacement, return the PLACEHOLDER_EXPR.
! We might have been called from tree optimization where we
! haven't set up an object yet. */
! if (new == 0)
! break;
! else
! exp = new;
!
continue;
}
*************** safe_from_p (x, exp, top_p)
*** 5779,5785 ****
{
case ADDR_EXPR:
! return (staticp (TREE_OPERAND (exp, 0))
! || TREE_STATIC (exp)
! || safe_from_p (x, TREE_OPERAND (exp, 0), 0));
case INDIRECT_REF:
--- 5793,5816 ----
{
case ADDR_EXPR:
! /* If the operand is static or we are static, we can't conflict.
! Likewise if we don't conflict with the operand at all. */
! if (staticp (TREE_OPERAND (exp, 0))
! || TREE_STATIC (exp)
! || safe_from_p (x, TREE_OPERAND (exp, 0), 0))
! return 1;
!
! /* Otherwise, the only way this can conflict is if we are taking
! the address of a DECL a that address if part of X, which is
! very rare. */
! exp = TREE_OPERAND (exp, 0);
! if (DECL_P (exp))
! {
! if (!DECL_RTL_SET_P (exp)
! || GET_CODE (DECL_RTL (exp)) != MEM)
! return 0;
! else
! exp_rtl = XEXP (DECL_RTL (exp), 0);
! }
! break;
case INDIRECT_REF:
*************** highest_pow2_factor (exp)
*** 6024,6029 ****
PLACEHOLDER_EXPR. An object "matches" if it is of the type of the
PLACEHOLDER_EXPR or a pointer type to it. For further information, see
! tree.def. If no such object is found, abort. If PLIST is nonzero, it is
! a location which initially points to a starting location in the
placeholder list (zero means start of the list) and where a pointer into
the placeholder list at which the object is found is placed. */
--- 6055,6060 ----
PLACEHOLDER_EXPR. An object "matches" if it is of the type of the
PLACEHOLDER_EXPR or a pointer type to it. For further information, see
! tree.def. If no such object is found, return 0. If PLIST is nonzero, it
! is a location which initially points to a starting location in the
placeholder list (zero means start of the list) and where a pointer into
the placeholder list at which the object is found is placed. */
*************** find_placeholder (exp, plist)
*** 6084,6088 ****
}
! abort ();
}
--- 6115,6119 ----
}
! return 0;
}
*************** expand_expr (exp, target, tmode, modifie
*** 6618,6621 ****
--- 6649,6655 ----
exp = find_placeholder (exp, &placeholder_expr);
+ if (exp == 0)
+ abort ();
+
placeholder_list = TREE_CHAIN (placeholder_expr);
temp = expand_expr (exp, original_target, tmode, ro_modifier);