[Openmcl-devel] Tracking Down CFFI Problem [SOLVED]

Brent Fulgham bfulgham at gmail.com
Sun Aug 17 20:56:29 PDT 2008


Hi,

Just for future web searchers, I thought I would report that I  
resolved the problem.

On Aug 10, 2008, at 3:12 AM, Gary Byers wrote:

> I just glanced at this and may be missing something, but the code
> didn't look like it'd ever been built on a 64-bit system.  Just trying
> to build the C library on a 64-bit Linux system (where the C compiler/
> toolchain assume a 64-bit world) led to

As Gary pointed out, there were several 32-bit assumptions in the  
original code that caused the problem.  The matrix was correctly built  
to hold 64-bit double values, but it assumed pointer sizes were 32- 
bits.  Consequently, the matrix was constructed as an array of three  
32-bit values that were supposed to hold the pointers to corresponding  
arrays of 64-bit doubles.  Through some luck (probably due to padding  
on 64-bit boundaries) the first two pointers ended up being valid,  
while the third was garbage.

A thorough review of the entire C code-base (and use of the - 
Wconversion and -Wshorten-64-to-32 flags) helped track down the cause  
of this problem, as well as several other less catastrophic issues I  
had not noticed yet.

Thanks for the helpful pointers!

-Brent



More information about the Openmcl-devel mailing list