aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.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/tree-ssa.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/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 76e4e8b..51b1689 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -875,13 +875,21 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
&& POINTER_TYPE_P (outer_type))
{
/* If the outer type is (void *) or a pointer to an incomplete
- record type, then the conversion is not necessary. */
+ record type or a pointer to an unprototyped function,
+ then the conversion is not necessary. */
if (VOID_TYPE_P (TREE_TYPE (outer_type))
|| (AGGREGATE_TYPE_P (TREE_TYPE (outer_type))
&& TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE
&& (TREE_CODE (TREE_TYPE (outer_type))
== TREE_CODE (TREE_TYPE (inner_type)))
- && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))))
+ && !COMPLETE_TYPE_P (TREE_TYPE (outer_type)))
+ || ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
+ && (TREE_CODE (TREE_TYPE (outer_type))
+ == TREE_CODE (TREE_TYPE (inner_type)))
+ && !TYPE_ARG_TYPES (TREE_TYPE (outer_type))
+ && useless_type_conversion_p (TREE_TYPE (TREE_TYPE (outer_type)),
+ TREE_TYPE (TREE_TYPE (inner_type)))))
return true;
/* Do not lose casts to restrict qualified pointers. */