re PR middle-end/23714 (ICE in expand_assignment)

PR 23714
        * builtins.c (expand_builtin_trap): Export.
        * expr.h (expand_builtin_trap): Declare.
        * expr.c (expand_assignment): Emit a trap for integral offsets
        from registers that weren't reduced to bitpos.

        * tree-cfg.c (mark_array_ref_addressable_1): Remove.
        (mark_array_ref_addressable): Remove.
        * tree-flow.h (mark_array_ref_addressable): Remove.
        * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Don't call it.

From-SVN: r105449
This commit is contained in:
Richard Henderson 2005-10-15 17:07:17 -07:00 committed by Richard Henderson
parent 48c410a254
commit 1e188d1e13
7 changed files with 25 additions and 38 deletions

View File

@ -1,3 +1,16 @@
2005-10-15 Richard Henderson <rth@redhat.com>
PR 23714
* builtins.c (expand_builtin_trap): Export.
* expr.h (expand_builtin_trap): Declare.
* expr.c (expand_assignment): Emit a trap for integral offsets
from registers that weren't reduced to bitpos.
* tree-cfg.c (mark_array_ref_addressable_1): Remove.
(mark_array_ref_addressable): Remove.
* tree-flow.h (mark_array_ref_addressable): Remove.
* tree-optimize.c (execute_cleanup_cfg_post_optimizing): Don't call it.
2005-10-15 James E Wilson <wilson@specifix.com>
PR target/24232

View File

@ -4751,7 +4751,7 @@ expand_builtin_expect_jump (tree exp, rtx if_false_label, rtx if_true_label)
return ret;
}
static void
void
expand_builtin_trap (void)
{
#ifdef HAVE_trap

View File

@ -3924,10 +3924,18 @@ expand_assignment (tree to, tree from)
if (offset != 0)
{
rtx offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, EXPAND_SUM);
rtx offset_rtx;
gcc_assert (MEM_P (to_rtx));
if (!MEM_P (to_rtx))
{
/* We can get constant negative offsets into arrays with broken
user code. Translate this to a trap instead of ICEing. */
gcc_assert (TREE_CODE (offset) == INTEGER_CST);
expand_builtin_trap ();
to_rtx = gen_rtx_MEM (BLKmode, const0_rtx);
}
offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, EXPAND_SUM);
#ifdef POINTERS_EXTEND_UNSIGNED
if (GET_MODE (offset_rtx) != Pmode)
offset_rtx = convert_to_mode (Pmode, offset_rtx, 0);

View File

@ -341,6 +341,7 @@ extern rtx default_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
extern void expand_builtin_setjmp_setup (rtx, rtx);
extern void expand_builtin_setjmp_receiver (rtx);
extern rtx expand_builtin_saveregs (void);
extern void expand_builtin_trap (void);
/* Functions from expr.c: */

View File

@ -421,39 +421,6 @@ fold_cond_expr_cond (void)
}
}
/* Mark the array of any remaining ARRAY_REFs as addressable. */
static tree
mark_array_ref_addressable_1 (tree *tp, int *walk_subtrees,
void *data ATTRIBUTE_UNUSED)
{
tree t = *tp;
if (DECL_P (t) || TYPE_P (t))
*walk_subtrees = 0;
else if (TREE_CODE (t) == ARRAY_REF)
{
tree base = get_base_address (TREE_OPERAND (t, 0));
if (base && DECL_P (base))
TREE_ADDRESSABLE (base) = 1;
}
return NULL_TREE;
}
void
mark_array_ref_addressable (void)
{
basic_block bb;
block_stmt_iterator i;
FOR_EACH_BB (bb)
{
for (i = bsi_start (bb); !bsi_end_p(i); bsi_next(&i))
walk_tree (bsi_stmt_ptr (i), mark_array_ref_addressable_1, NULL, NULL);
}
}
/* Join all the blocks in the flowgraph. */
static void

View File

@ -556,7 +556,6 @@ extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
tree, tree, tree, tree);
extern void init_empty_tree_cfg (void);
extern void fold_cond_expr_cond (void);
extern void mark_array_ref_addressable (void);
extern void replace_uses_by (tree, tree);
extern void start_recording_case_labels (void);
extern void end_recording_case_labels (void);

View File

@ -133,7 +133,6 @@ static void
execute_cleanup_cfg_post_optimizing (void)
{
fold_cond_expr_cond ();
mark_array_ref_addressable ();
cleanup_tree_cfg ();
cleanup_dead_labels ();
group_case_labels ();