Why does casting a function generate a run-time abort?

Richard Henderson rth@redhat.com
Sat Jun 19 01:41:00 GMT 2004


On Fri, Jun 18, 2004 at 06:01:10PM -0700, Ziemowit Laski wrote:
> Since the standard does not define the semantics of the call,
> we may as well let it through.  I believe that is standard-conforming.

You're wrong.

# 6.5.2.2:
# 9 If the function is defined with a type that is not compatible with the
#   type (of the expression) pointed to by the expression that denotes the
#   called function, the behavior is undefined.

> Just what exactly is wrong with the asm() trick I came up with?  I am,
> of course, asking for technical arguments, not aesthetic ones.

Technical argument?  How about needless creation of FUNCTION_DECLs.
I'd have thought the aesthetic argument was good enough, however.



r~



More information about the Gcc mailing list