5 Jun 2006 00:51
corrupted foreign structure testcase with latest CFFI and LW 4.4.6
Jack Unrue <jdunrue <at> gmail.com>
2006-06-04 22:51:23 GMT
2006-06-04 22:51:23 GMT
I've run into a problem where populating a foreign structure and then passing it to a foreign function behaves correctly if my Lisp code is interpreted, but the structure fields appear to be corrupted if my function is compiled. This is with CFFI versions later than 0.9.0, and on LW 4.4.6 under WinXP. When I invoke the dump-it function in interpreted mode, the output file contains the expected result: cbSize: 4 style: 01abcdef When I (compile 'dump-it) and then invoke it, the output file contains garbage: cbSize: -1412567292 style: 01abcd01 This testcase works fine with the same LW version but CFFI 0.9.0. It also works fine with CLISP 2.38 and latest CFFI. CFFI versions 0.9.1, 060514, and a build produced from a darcs pull today all show the problem on LW. I haven't tried bisecting any further. See attached testcase.lisp and structs.c. I've also attached a simple Makefile for compiling with gcc. The foreign function dump_blah writes a file called 'dump_output.txt' in the current(Continue reading)
Yeah, those compiler macros were calling fli:foreign-typed-aref
incorrectly. I remember James and I discussing this optimization and
we were both tricked by the documentation that suggests this function
takes an array index, not an offset in bytes.
I've pushed a fix to the darcs repository. Thank you for the report
and test case. And thank you and Luke for tracking the down the
changes that introduced this bug.
RSS Feed