This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: gfortran, ncar and blockdata_test failures
- From: Jack Howarth <howarth at bromo dot msbb dot uc dot edu>
- To: Walter Spector <w6ws at earthlink dot net>
- Cc: fortran at gcc dot gnu dot org
- Date: Sat, 17 Nov 2007 09:38:08 -0500
- Subject: Re: gfortran, ncar and blockdata_test failures
- References: <473EF615.29E59AB3@earthlink.net>
Walter,
Could you open up a PR for this problem with your testcases
and observations? I would think a decent argument could be made
for it being a regression from g77.
Jack
On Sat, Nov 17, 2007 at 06:09:25AM -0800, Walter Spector wrote:
> Jack Howarth wrote:
> > Has anyone looked@the blockdata_test suite that the NCL/NCAR
> > developers have posted...
> >
> > http://www.ncl.ucar.edu/Download/build_from_src.shtml#CompilersNeeded
> >
> > I find on powerpc-apple-darwin9 that both gcc 4.2.2 and the current
> > gcc 4.3 snapshots fail this test....
>
> Ah - the old "put block data in a library, and use EXTERNAL to make sure
> it gets linked in" trick. Many compilers have gotten this wrong over
> the years, because it is kinda on the edge of being required by the
> Standard (any of them).
>
> On my cygwin system, g77 and g95 get it right and gfortran gets it wrong.
> See below.
>
> While F90 modules fixed this problem by obsoleting BLOCK DATA and
> COMMON, quite a number of older library packages depend on this working.
>
> Walter
>
>
> $ cat testsub.f
> SUBROUTINE TESTSUB
> EXTERNAL BDTEST
> COMMON/TEST/WK
> INTEGER WK
> PRINT *,'TESTSUB: WK = ',WK, '...it should be 20'
> RETURN
> END
>
> $ g77 -c testsub.f
> $ nm testsub.o
> 00000000 b .bss
> 00000000 d .data
> 00000000 r .rdata
> 00000000 t .text
> 00000004 d ___g77_cilist_0.1
> 00000000 d ___g77_forceload_0.0
> U _bdtest_ <<<< This references the BLOCK DATA
> U _do_lio
> U _e_wsle
> U _s_wsle
> 00000010 C _test_
> 00000000 T _testsub_
>
> $ gfortran -c testsub.f
> $ nm testsub.o
> 00000000 b .bss
> 00000000 d .data
> 00000000 r .rdata
> 00000000 t .text <<<< Missing a reference to _bdtest_ here
> U __gfortran_st_write
> U __gfortran_st_write_done
> U __gfortran_transfer_character
> U __gfortran_transfer_integer
> 00000010 C _test_
> 00000000 T _testsub_
>
> $