I am having a hard time diagnosing a DIVIDE-BY-ZERO condition when I invoke the foreign function DGESVD (LAPACK) on OSX with arguments in [1].

What is making the problem difficult to diagnose is:
- the problem does not occur on FreeBSD or Linux. 
- the problem does not occur if I call the same function with arguments [2] on exactly the same  input.
- the problem does not occur on OSX when using ECL or CCL.
- the problem does not occur on OSX when I call the function in a different thread. 

I stumbled across the last point as I have had no issues with the call when using the SLIME REPL. I only encountered the issue when invoking it from the command line.

There is the possibility that there is a bug in my code, however, I have had a number of SBCL processes running on several Linux hosts, each of which have been running continuously for three weeks. These processes call DGESVD about two times a second with arguments [2] and about once every five minutes with arguments [1]. 

I have tried the following versions of LAPACK to try and rule out LAPACK.
- /usr/lib/libblas.dylib provided with OSX 10.8 and OSX 10.7
- LAPACK 3.4.2 from the NETLIB website compiled with gfortran (macports) version 4.8.

I have tried SBCL versions 1.1.7, 1.1.8 (fancy), 1.1.8 (not fancy and no threads) and HEAD and the same error occurs.

I am not sure what to do now.


[1] I am only calculating the singular values i.e. JOBU = "N" and JOBVT = "N".
[2] Calculating the left and right singular vectors using JOBU = "S" and JOBVT = "S".