Hi Peter, Peter Teeson <peter.tee...@me.com> writes: > Many thanks for your reply. A nice demo but, no disrespect, maybe not > really the issue.
With all due respect, I think that Ludovic discovered the root of the problem, and that you're on the wrong track. However, I've reached a different conclusion than Ludovic about where the fault lies, based on my different interpretation of the x86-64 ABI. I've replied to the original bug report with my analysis of the problem: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13342#32 In brief, the problem is an incompatibility between libffi and Clang, because they have interpreted the x86-64 ABI requirements differently. Specifically, libffi ZERO-extends arguments passed in registers when calling foreign functions on x86-64 platforms, and Clang assumes that the caller will SIGN-extend the arguments. Regards, Mark