https://github.com/atgreen/libffi/commit/6a790129427121f7db2d876e7218a3104e6d2741 fixes a problem in libffi that caused the blocked bugs in python's ctypes tests. It would be nice if someone can test the fix.
This needs to be fixed in llvm. libffi isn't the only place you're going to run into issues with this.
http://gcc.gnu.org/ml/gcc/2013-01/msg00447.html
Have you seen http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46942 and http://llvm.org/bugs/show_bug.cgi?id=15153?
The code gcc produces doesn't _rely_ on the extension taking place. They do extension to avoid partial register stalls, but that's an optimization, not a requirement. The bug you reference refers to the fact that they sign-extend at both the caller and callee, which is redundant. But the bug in LLVM is not whether they extend at the caller or the callee, it's that they assume that the extension has to happen. That said I don't mind carrying a temporary workaround for llvm compatibility in libffi until it gets fixed or the ABI is changed.
(In reply to comment #0) even libffi themselves say this isn't a fix bug a workaround
Yeah, after reading the mailing list thread referenced above, you're right. I've relayed the information to the LLVM team, so it should get fixed in a future version of LLVM. Perhaps we should cherry-pick an LLVM patch instead of this libffi patch in the meantime?
This patch is in 3.0.12.