summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-16 02:20:40 +0000
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-16 02:20:40 +0000
commitd067185e213f6a0fa48055ee34ad63a0682b974b (patch)
tree5246fae20e2ea5ace9d99edf2218261f1d06abfa /gcc/fold-const.c
parenta6d172351baf937eb1c5d59f03bf375826d2ea2f (diff)
downloadgcc-d067185e213f6a0fa48055ee34ad63a0682b974b.tar.gz
PR middle-end/23369
* fold-const.c (build_range_check): Disable optimization for function pointer expressions on targets that require function pointer canonicalization. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103145 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 19b5459a03f..84dad8b7fb7 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3929,6 +3929,15 @@ build_range_check (tree type, tree exp, int in_p, tree low, tree high)
tree etype = TREE_TYPE (exp);
tree value;
+#ifdef HAVE_canonicalize_funcptr_for_compare
+ /* Disable this optimization for function pointer expressions
+ on targets that require function pointer canonicalization. */
+ if (HAVE_canonicalize_funcptr_for_compare
+ && TREE_CODE (etype) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (etype)) == FUNCTION_TYPE)
+ return NULL_TREE;
+#endif
+
if (! in_p)
{
value = build_range_check (type, exp, 1, low, high);