[Bug c/45106] casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems
--- Comment #1 from robert dot haschke at uni-bielefeld dot de 2010-07-28 11:52 --- Created an attachment (id=21335) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21335action=view) preprocessed file -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45106
[Bug c/45106] casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems
--- Comment #2 from robert dot haschke at uni-bielefeld dot de 2010-07-28 11:53 --- Created an attachment (id=21336) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21336action=view) original .c file -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45106
[Bug c/45106] casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems
--- Comment #3 from jakub at gcc dot gnu dot org 2010-07-28 11:57 --- Don't do it, it is not valid. The x86-64 ABI requires that for varargs the %al register contains number of SSE regs that need saving, while for non-varargs functions that register is undefined. -- jakub at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45106
[Bug c/45106] casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems
--- Comment #4 from rhaschke at techfak dot uni-bielefeld dot de 2010-07-28 12:04 --- Subject: Re: casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems I was afraid of this answer. However in my application, I have no clue which type of function pointer is transferred. Thus, I should always cast to the variadic function pointer in order to define the %al register? Cheers, Robert -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45106
[Bug c/45106] casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems
--- Comment #5 from schwab at linux-m68k dot org 2010-07-28 12:26 --- Calling a function with a different signature than declared is undefined in any case. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45106
[Bug c/45106] casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems
--- Comment #6 from rguenth at gcc dot gnu dot org 2010-07-28 14:01 --- (In reply to comment #4) Subject: Re: casting of variadic function pointers to normal function pointers causes segfaults on 64bit systems I was afraid of this answer. However in my application, I have no clue which type of function pointer is transferred. Thus, I should always cast to the variadic function pointer in order to define the %al register? Cheers, Robert That doesn't work either. You have to pass around some cookie that tells you the function prototype and cast to the appropriate one. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45106