Clifford W Johnson <cliff...@ieee.org> added the comment:

Turns out the problem is really in the Sparc version of libffi -- the 
ffi_closure_sparc_inner_v9 function in 
Modules/_ctypes/libffi/src/sparc/ffi.c wasn't properly accounting for 
the 16-byte alignment of a long double in an argument stack -- it 
presumed 8-byte alignment throwing off any long double value after a 
shorter value.  (16-byte alignment is specified in the SPARC Compliance 
Definition.)

I've attached a patch which I'm sure could be improved (there's 
probably a more proper way to do things in libffi) but it passes the 
check tests for ctypes and a few other tests I threw in.


By the way, I noticed that one of the test cases in the script I added 
in my last comment has an error in its success/failure test ... 
the "(typ, c_byte)" test should check for the result of -3 instead of 
3.14.

----------
keywords: +patch
Added file: http://bugs.python.org/file14037/sparc_longdouble.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6029>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to