From 38a178dd99642468bfbc390a5b8b8d17dd926cdc Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 9 Jul 2010 18:32:29 +0000 Subject: [PATCH] re PR middle-end/44890 (Hitting gcc_assert in build2_stat with pr30388.c testsuite test case) 2010-07-09 Richard Guenther PR middle-end/44890 * tree-ssa-address.c (create_mem_ref_raw): Only build a MEM_REF if base is a pointer. * tree-cfg.c (verify_expr): Update MEM_REF checking. From-SVN: r162005 --- gcc/ChangeLog | 7 +++++++ gcc/tree-cfg.c | 3 ++- gcc/tree-ssa-address.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e7c944f8b0d..b3c9f387d35 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-07-09 Richard Guenther + + PR middle-end/44890 + * tree-ssa-address.c (create_mem_ref_raw): Only build a MEM_REF + if base is a pointer. + * tree-cfg.c (verify_expr): Update MEM_REF checking. + 2010-07-08 Michael Meissner PR target/44877 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index c7007937c47..9e38ca717a1 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2610,7 +2610,8 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) case MEM_REF: x = TREE_OPERAND (t, 0); - if (!is_gimple_mem_ref_addr (x)) + if (!POINTER_TYPE_P (TREE_TYPE (x)) + || !is_gimple_mem_ref_addr (x)) { error ("Invalid first operand of MEM_REF."); return x; diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index cf7a81d66d0..f49bf14caea 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -352,7 +352,8 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr) /* If possible use a plain MEM_REF instead of a TARGET_MEM_REF. */ if (alias_ptr_type && !addr->index - && !addr->step) + && !addr->step + && (!addr->base || POINTER_TYPE_P (TREE_TYPE (addr->base)))) { tree base, offset; gcc_assert (!addr->symbol ^ !addr->base);