This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42568] [Cygwin] BLOCKDATA referenced in EXTERNAL not loading from library
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jan 2010 17:13:55 -0000
- Subject: [Bug fortran/42568] [Cygwin] BLOCKDATA referenced in EXTERNAL not loading from library
- References: <bug-42568-18131@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #16 from kargl at gcc dot gnu dot org 2010-01-04 17:13 -------
(In reply to comment #15)
> (In reply to comment #14)
> > (In reply to comment #12)
> > > COMMON symbols don't cause members to be pulled in from library archives. You
> > > can omit "-L. -lex" from the final link altogether and get the same result:
> > > it's unused. So the reference from bug.o to _jindx2 doesn't cause the library
> > > archive member to be drawn into the final link.
> > >
> >
> > Comment #1 seems to contradict your assertion here. To repeat,
> >
> > laptop:kargl[207] gfc4x -c a2.f
> > laptop:kargl[208] ar -cru libex.a a2.o
> > laptop:kargl[209] gfc4x -o z a1.f -L. -lex
> > laptop:kargl[210] ./z
> > chars=abcdeabcdeabcdeabcdeabcde
> > *missingBlockData* loaded common block
>
> I can't tell anything from that. What is gfc4x, and what are a1.f and a2.f?
gfc4x is gfortran 4.5.
a1.f is OP's main program with the character(len=20)
replaced by character(len=5) to prevent screen wrap
on output.
a2.f is OP's block data file.
laptop:kargl[205] cat a1.f a2.f
!
! File a1.f
!
program missingBlockData
external juinit2
character chars(5)*(5)
common /qindex2/chars
save /qindex2/
write(*,*)'chars=',chars
if(chars(5).ne.'abcde')then
write(*,*)'*missingBlockData* E-R-R-O-R: bad load'
else
write(*,*)'*missingBlockData* loaded common block'
endif
end
!
! File a2.f
!
block data juinit2
character chars(5)*(5)
common /qindex2/chars
save /qindex2/
data chars/5*'abcde'/
end
You made an unmerited assertion that "COMMON symbols don't cause
members to be pulled in from library archives." I've shown the
counter example. This appears to be linker issue on cygwin.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42568