This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



On 18 Jun 2004, at 12.00, Geoffrey Keating wrote:


Ziemowit Laski <zlaski@apple.com> writes:

On 17 Jun 2004, at 22.55, Eric Botcazou wrote:

Could someone shed some light on this?

The behaviour is undefined in C at run-time (6.3.2.3 §8) so generating an abort is permitted. This should not trigger in Objective-C (at least that's how it was written for 3.4).

Right; there is an ugly 'if(!c_dialect_objc())' in front of the whole thing. Although I do see that an abort is indeed permitted under the circumstances, I'm still mystified as to why this became an issue in the first place. Why not just construct a function call using the signature specified in the cast? Aside from not being able to inline the call, I'm not quite sure what the problem is...

Because if you *do* try to inline the call, you will get an ICE.

So don't inline it. :-) In fact, you can even produce an informative warning "Could not inline call due to incompatible cast".


--Zem


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]