Given this eq-mod.f90

module aap
   real a(5)
   real b(3)
   equivalence (a(3),b(1))
end module aap

and the following main program eq-main.f90

use aap, only : b
print*,b
end

draws, when compiling with GNU Fortran (GCC) 4.2.1 20070523 (prerelease),
as follows:

[EMAIL PROTECTED]:~/g95-bugs$ /usr/rel/bin/gfortran -c eq-mod.f90
[EMAIL PROTECTED]:~/g95-bugs$ /usr/rel/bin/gfortran -c eq-main.f90
[EMAIL PROTECTED]:~/g95-bugs$ /usr/rel/bin/gfortran -static eq-main.o eq-mod.o
eq-main.o: In function `MAIN__':
eq-main.f90:(.text+0x78): undefined reference to `__aap(bool)'
collect2: ld returned 1 exit status

The "(bool)" is a red herring, caused by collect2's "helpful" reinterpretation
of the following external reference:

[EMAIL PROTECTED]:~/g95-bugs$ nm eq-main.o
                 U __aap__b
...


-- 
           Summary: Module with equivalence draws "unsatisfied reference"
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: toon at moene dot indiv dot nluug dot nl


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32103

Reply via email to