------- 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

Reply via email to