re PR middle-end/17564 (New treatment of function pointers when used with equality operators, when casts are involved)
PR middle-end/17564 * dojump.c (do_compare_and_jump): Only canonicalize function pointers in a comparison if both sides are function pointers. Co-Authored-By: John David Anglin <dave.anglin@nrc-cnrc.gc.ca> From-SVN: r92061
This commit is contained in:
parent
25da5dc7c6
commit
b8c26d709c
@ -1,3 +1,10 @@
|
||||
2004-12-12 Nathanael Nerode <neroden@gcc.gnu.org>
|
||||
John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
|
||||
|
||||
PR middle-end/17564
|
||||
* dojump.c (do_compare_and_jump): Only canonicalize function pointers
|
||||
in a comparison if both sides are function pointers.
|
||||
|
||||
2004-12-12 Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR target/18932
|
||||
|
21
gcc/dojump.c
21
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;
|
||||
|
Loading…
Reference in New Issue
Block a user