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?


> Compiling the following snippet
> 
>    typedef struct objc_Object * foo_id ;
>    typedef struct blortstruct *blort ;
>    extern foo_id objc_msgSend(foo_id, ...);
> 
>    int main(int argc, char * argv[])
>    {
>      blort foo = 0, bar = 0 ;
>      foo_id obj0;
>      obj0 = ((foo_id ((*)(foo_id, char *, blort, blort))) &objc_msgSend) 
> (obj0, "foo message", foo, bar);
>      return 0;
>    }
> 
> on the current TOT produces the following messages:
> 
>    R3692996.c: In function `main':
>    R3692996.c:9: warning: function called through a non-compatible type
>    R3692996.c:9: note: if this code is reached, the program will abort

Just some links to ponder on:
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01891.html
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg00683.html


Thanks,
Andrew Pinski


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