This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/52329] Invalid MEM_REF encountered in set_mem_attributes_minus_bitpos
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 22 Feb 2012 09:57:22 +0000
- Subject: [Bug middle-end/52329] Invalid MEM_REF encountered in set_mem_attributes_minus_bitpos
- Auto-submitted: auto-generated
- References: <bug-52329-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52329
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-22 09:57:22 UTC ---
I'm not sure we care about preserving pointer types in debug stmts, nor if
the mem-ref stripping is needed (well, build_fold_addr_expr does that, too).
Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c (revision 184460)
+++ gcc/gimple-fold.c (working copy)
@@ -1250,6 +1250,18 @@ fold_stmt_1 (gimple_stmt_iterator *gsi,
changed = true;
}
}
+ else if (val
+ && TREE_CODE (val) == ADDR_EXPR)
+ {
+ tree ref = TREE_OPERAND (val, 0);
+ tree tem = maybe_fold_reference (ref, false);
+ if (tem)
+ {
+ tem = build_fold_addr_expr_with_type (tem, TREE_TYPE (val));
+ gimple_debug_bind_set_value (stmt, tem);
+ changed = true;
+ }
+ }
}
break;
fixes it for me.