This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved
- From: "dave at hiauly1 dot hia dot nrc dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Nov 2004 04:09:58 -0000
- Subject: [Bug middle-end/17564] [4.0 Regression] New treatment of function pointers when used with equality operators, when casts are involved
- References: <20040919231932.17564.danglin@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca 2004-11-27 04:09 -------
Subject: Re: [4.0 Regression] New treatment of function
> ------- 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?)
I believe we really want noncanonicalized pointers. For example, the
following code works in 3.4 (i.e., a function pointer cast to void
pointer and back to a function pointer yields a function pointer that
can be used in a call to a compatible function):
void *f (void) __attribute__ ((__noinline__));
void *
f (void)
{
return f;
}
int
main (void)
{
void * (*g) (void) = f ();
if (g () != f)
abort ();
exit (0);
}
If the call to f returned a canonicalized value, the call using g
would fail if the target was in a shared library (external). The
PIC register wouldn't be correctly set.
Dave
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17564