Problem with shared libraries and Fortran common
|Reported by:||gropp||Owned by:||goodell|
I'm having a problem with some of the Spawn tests in Fortran 90 when running on my Mac, and after some investigation, I discovered that MPI_ARGV_NULL in Fortran 77 and in Fortran 90 were not the same location in memory. Unfortunately, the spawn code relies on the initialization of the value of this location, and only one is set (there are probably other problems with tests for things like MPI_IN_PLACE).
My guess is that since the common block that contains this variable is present in two shared libraries, the linker on the Mac isn't resolving them to the same address but instead making them unique only within their library. Picking static linking isn't an option on Macs as critical system libraries only exists in shared form, and -static only works if everything is available in static form.
I'm using gfortran as the F77 and F90 compiler, so there are no compatibility problems between the Fortran compilers.
One fix might be to force these into a single Fortran library, rather than separate ones for Fortran and Fortran90, particularly when the compilers are the same. There might be other fixes that make common blocks behave correctly with shared libraries (the behavior makes sense when building components for which the common is supposed to be private to the component; unfortunately, that's not what is expected in the Fortran standard).
Change History (9)
comment:8 Changed 20 months ago by goodell
- Resolution set to fixed
- Status changed from accepted to closed