From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31519 invoked by alias); 4 Jan 2010 17:14:06 -0000 Received: (qmail 31475 invoked by uid 48); 4 Jan 2010 17:13:55 -0000 Date: Mon, 04 Jan 2010 17:14:00 -0000 Message-ID: <20100104171355.31474.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/42568] [Cygwin] BLOCKDATA referenced in EXTERNAL not loading from library In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "kargl at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-01/txt/msg00409.txt.bz2 ------- 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