summaryrefslogtreecommitdiffstats
path: root/gcc/dojump.c
diff options
context:
space:
mode:
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-12 21:01:17 +0000
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-12 21:01:17 +0000
commitdce9431b82c6dbe094e64863711351117a9aff12 (patch)
tree222d8cc2a15f29ae26355787d23a5ff64786ba2b /gcc/dojump.c
parentb260855735f9cebe2e52e0e0cacd013bb0114c54 (diff)
downloadppe42-gcc-dce9431b82c6dbe094e64863711351117a9aff12.tar.gz
ppe42-gcc-dce9431b82c6dbe094e64863711351117a9aff12.zip
PR middle-end/17564
* dojump.c (do_compare_and_jump): Only canonicalize function pointers in a comparison if both sides are function pointers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92061 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dojump.c')
-rw-r--r--gcc/dojump.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 93bcb8be41a..b1e17ec8803 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -904,24 +904,23 @@ do_compare_and_jump (tree exp, enum rtx_code signed_code,
#ifdef HAVE_canonicalize_funcptr_for_compare
/* If function pointers need to be "canonicalized" before they can
- be reliably compared, then canonicalize them. */
+ be reliably compared, then canonicalize them.
+ Only do this if *both* sides of the comparison are function pointers.
+ If one side isn't, we want a noncanonicalized comparison. See PR
+ middle-end/17564. */
if (HAVE_canonicalize_funcptr_for_compare
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))))
- == FUNCTION_TYPE))
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 0))))
+ == FUNCTION_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 1))) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 1))))
+ == FUNCTION_TYPE)
{
rtx new_op0 = gen_reg_rtx (mode);
+ rtx new_op1 = gen_reg_rtx (mode);
emit_insn (gen_canonicalize_funcptr_for_compare (new_op0, op0));
op0 = new_op0;
- }
-
- if (HAVE_canonicalize_funcptr_for_compare
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 1))) == POINTER_TYPE
- && (TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (exp, 1))))
- == FUNCTION_TYPE))
- {
- rtx new_op1 = gen_reg_rtx (mode);
emit_insn (gen_canonicalize_funcptr_for_compare (new_op1, op1));
op1 = new_op1;
OpenPOWER on IntegriCloud