http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55891
Bug #: 55891
Summary: Problem with shared library and EQUIVALENCE on darwin
11.4.2 x86_64
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
On a x86_64 system with Darwin Kernel Version 11.4.2, and if you use to compile
the programs:
gfortran -shared -fPIC mod.f90 -o lib.so
gfortran -fPIC main.f90 lib.so
The main program does not receive the values from the module (i.e. the print
statement will print 0,0). It works if you use a static library.
main.f90:
PROGRAM main
USE LIB2
IMPLICIT NONE
CALL f()
PRINT*,i,j
END PROGRAM main
mod.f90:
MODULE LIB2
INTEGER i
INTEGER :: j
EQUIVALENCE (j, i)
CONTAINS
SUBROUTINE f()
IMPLICIT NONE
j = 40
END SUBROUTINE f
END MODULE LIB2
nm lib.so
0000000000000f9a T ___lib2_MOD_f
0000000000000f94 t __dyld_func_lookup
0000000000001010 S _lib2.eq.0_
U dyld_stub_binder
0000000000000f80 t dyld_stub_binding_helper