Problem : On Mac OS X 10.6.x “Snow Leopard”, Fortran programs that declare COMMON blocks may have unexpected behavior, including “bus error”, if the COMMON block shares a name with a routine in a static library that is linked against.
Environment : Mac OS 10.6.x with Xcode 3.2.1
Root Cause : Apple has confirmed that this is caused by a defect in the linker supplied with Mac OS 10.6, which is ld64-95.2.12 and newer versions of ld. To follow the issue and its eventual resolution, please refer to the known defect number 7890410 at http://developer.apple.com/bugreporter/
Resolution : If you wish to have Apple notify you when this issue is resolved, file a bug report at http://developer.apple.com/bugreporter/
Workaround: Rename the COMMON block so as not to duplicate a name in a static library.
Example: A COMMON block named SEED will cause problems because the Intel Fortran run-time library contains a portability routine named SEED.
Solution: By simply renaming the SEED common block in the example code below to something like ABCD, this code will not encounter the Sigbus crash.
program fixcommon
DOUBLE PRECISION DSEED
c COMMON/SEED/ISEED
COMMON/ABCD/ISEED
iseed = 1
DSEED=DFLOAT(ISEED)
write(6,*) 'done'
stop
end
Environment : Mac OS 10.6.x with Xcode 3.2.1
Root Cause : Apple has confirmed that this is caused by a defect in the linker supplied with Mac OS 10.6, which is ld64-95.2.12 and newer versions of ld. To follow the issue and its eventual resolution, please refer to the known defect number 7890410 at http://developer.apple.com/bugreporter/
Resolution : If you wish to have Apple notify you when this issue is resolved, file a bug report at http://developer.apple.com/bugreporter/
Workaround: Rename the COMMON block so as not to duplicate a name in a static library.
Example: A COMMON block named SEED will cause problems because the Intel Fortran run-time library contains a portability routine named SEED.
Solution: By simply renaming the SEED common block in the example code below to something like ABCD, this code will not encounter the Sigbus crash.
program fixcommon
DOUBLE PRECISION DSEED
c COMMON/SEED/ISEED
COMMON/ABCD/ISEED
iseed = 1
DSEED=DFLOAT(ISEED)
write(6,*) 'done'
stop
end
