aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-08-26 13:23:04 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-08-26 13:23:04 +0000
commit6b8b9e4262617040a6879600a8e411f95ec30b1b (patch)
tree0a7c596dcfad5b0a80e1635e57a2911b24a32034 /gcc/gimplify.c
parent5c89ef5a3f267a25ffab1735adc754d43c486e0f (diff)
downloadgcc-6b8b9e4262617040a6879600a8e411f95ec30b1b.zip
gcc-6b8b9e4262617040a6879600a8e411f95ec30b1b.tar.gz
gcc-6b8b9e4262617040a6879600a8e411f95ec30b1b.tar.bz2
re PR c/41163 (verify_gimple fails)
2009-08-26 Richard Guenther <rguenther@suse.de> PR middle-end/41163 * gimplify.c (gimplify_addr_expr): Canonicalize ADDR_EXPRs if the types to not match. * tree-cfg.c (verify_gimple_assign_single): Adjust ADDR_EXPR verification. * tree-ssa.c (useless_type_conversion_p): Conversions to pointers to unprototyped functions are useless. * gcc.c-torture/compile/pr41163.c: New testcase. * gcc.dg/pr35899.c: Adjust. From-SVN: r151122
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index bdb64ea..7f1dc4a 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4725,10 +4725,22 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
if (TREE_CODE (op0) == INDIRECT_REF)
goto do_indirect_ref;
+ mark_addressable (TREE_OPERAND (expr, 0));
+
+ /* The FEs may end up building ADDR_EXPRs early on a decl with
+ an incomplete type. Re-build ADDR_EXPRs in canonical form
+ here. */
+ if (!types_compatible_p (TREE_TYPE (op0), TREE_TYPE (TREE_TYPE (expr))))
+ *expr_p = build_fold_addr_expr (op0);
+
/* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly. */
- recompute_tree_invariant_for_addr_expr (expr);
+ recompute_tree_invariant_for_addr_expr (*expr_p);
+
+ /* If we re-built the ADDR_EXPR add a conversion to the original type
+ if required. */
+ if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (*expr_p)))
+ *expr_p = fold_convert (TREE_TYPE (expr), *expr_p);
- mark_addressable (TREE_OPERAND (expr, 0));
break;
}