From 6c6d9d33ef1cfdc73d836b4acb70210a824b035a Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sat, 19 Mar 2005 16:45:59 +0000 Subject: re PR middle-end/20493 (Bootstrap failure because of aliased symbols) PR middle-end/20493 * fold-const.c (fold_widened_comparison): Don't optimize casts of function pointers on targets that require function pointer canonicalization. (fold_sign_changed_comparison): Likewise. From-SVN: r96733 --- gcc/fold-const.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 13e9153..bc17c1d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6074,6 +6074,15 @@ fold_widened_comparison (enum tree_code code, tree type, tree arg0, tree arg1) return NULL_TREE; shorter_type = TREE_TYPE (arg0_unw); +#ifdef HAVE_canonicalize_funcptr_for_compare + /* Disable this optimization if we're casting a function pointer + type on targets that require function pointer canonicalization. */ + if (HAVE_canonicalize_funcptr_for_compare + && TREE_CODE (shorter_type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (shorter_type)) == FUNCTION_TYPE) + return NULL_TREE; +#endif + if (TYPE_PRECISION (TREE_TYPE (arg0)) <= TYPE_PRECISION (shorter_type)) return NULL_TREE; @@ -6156,6 +6165,15 @@ fold_sign_changed_comparison (enum tree_code code, tree type, arg0_inner = TREE_OPERAND (arg0, 0); inner_type = TREE_TYPE (arg0_inner); +#ifdef HAVE_canonicalize_funcptr_for_compare + /* Disable this optimization if we're casting a function pointer + type on targets that require function pointer canonicalization. */ + if (HAVE_canonicalize_funcptr_for_compare + && TREE_CODE (inner_type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE) + return NULL_TREE; +#endif + if (TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type)) return NULL_TREE; -- cgit v1.1