gcc 4.2 more strict check for "function called through a non-compatible type"

Ian Lance Taylor iant@google.com
Wed Jul 5 16:23:00 GMT 2006


Andrew Pinski <pinskia@physics.uc.edu> writes:

> On Jul 5, 2006, at 8:38 AM, Ian Lance Taylor wrote:
> 
> > To me this is related to the point I raised at the steering committee
> > panel discussion (I know you weren't there): I think we are too casual
> > about breaking existing working code.
> 
> What happens when a target comes along and passes different pointers
> types
> differently.  Like say a floating point pointer in the FP register
> and an
> pointer to an integer in the general purpose register, wouldn't that
> also
> break the code in question?  Yes this is in theory but still saying
> we are
> breaking existing working code is bogus in this case.  The above
> reason is
> one of the reasons why this code is undefined because it does not
> make sense.

Yes, if the existing working code in question passed a floating point
value, then it would break.

The existing code in question is, essentially,
    void foo (char*)
    void bar (const char* s) { ((void (*) (const char*)) foo) (s); }
This too is undefined and might break.  But it is unlikely to break
because different types are passed in different register classes.

Ian



More information about the Gcc mailing list