------- Additional Comments From neroden at gcc dot gnu dot org 2004-11-27
00:53 -------
I'm going to guess that one solution is to canonicalize any function pointer
any time it's cast to a void pointer. (Or do you really, really want
noncanonicalized pointers, which is likely to be harder?)
This probably requires recognition at tree level that casts from function
pointer to void pointer may be necessary (among other things).
>From tree_ssa_useless_type_conversion_1 in tree_ssa.c:
/* If both types are pointers and the outer type is a (void *), then
the conversion is not necessary. The opposite is not true since
that conversion would result in a loss of information if the
equivalence was used. Consider an indirect function call where
we need to know the exact type of the function to correctly
implement the ABI. */
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type)
&& TYPE_MODE (inner_type) == TYPE_MODE (outer_type)
&& TYPE_REF_CAN_ALIAS_ALL (inner_type)
== TYPE_REF_CAN_ALIAS_ALL (outer_type)
&& TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
return true;
So it seems that this type conversion isn't useless when converting from
a function pointer to a void pointer (on targets where function pointers need
canonicalization); it requires a canonicalization. (Or a forcing of
non-canonicalization, which sounds harder.)
Confirming.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-11-27 00:53:19
date| |
Summary|[4.0 Regression] New |[4.0 Regression] New
|treatment of function |treatment of function
|pointers when used with |pointers when used with
|equality operators |equality operators, when
| |casts are involved
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17564