Egcs/G77 bug report

Gary A. Allen gallen@ironbark.arc.nasa.gov
Thu Apr 16 16:04:00 GMT 1998


Gentlemen,

I'm a newbee with G77 and DEC-Alphas.  This is my first bug report so 
please forgive me if I'm not following the proper protocol.  I'm running
a proprietary code named GASP on a Microway AlphaPC 164LX.  NASA is
allowed access to the source code (requiring nondisclosure) by GASP's
owners.   The following is the platform data:

	AlphaPC 164LX, 533 MHz.
	Linux version: 2.0.32
	Redhat version: 5.0

-----------------------------------------------------------------------
"g77 -v" yields:
-----------------------------------------------------------------------
Reading specs from /usr/local/lib/gcc-lib/alphaev56-unknown-linux-gnu/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
-----------------------------------------------------------------------

GASP is a stable hybrid C/Fortran program that currently runs on many
different platforms including Egcs under Linux for 386 and PowerPC chipsets. 
However GASP is NOT that well written.  It produces many warnings during
compilation.  GASP successfully compiled for the Alpha but when
running under Gdb (GNU debug) it produced the following error for one of
GASP's simplest example test cases (known to work on other platforms!):

------------------  Gdb output producing error ---------------------------
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (alpha-redhat-linux), Copyright 1996 Free Software Foundation, Inc...
(gdb) run  -i bump.inp -o bump.out
Starting program: /users/gallen/GASPv32/samples/Transbump/../../bin/gasp -i bump.inp -o bump.out
GASP Version 3.2.2
Copyright (c) 1998 AeroSoft, Inc.
All Rights Reserved


Gasp:  iBlockF[5] = 0
 initmg:  Multi-Grid style-1  0
 initmg:  Multi-Grid style-2  0

BC permanent & temp space = 0.000Mw and 0.000Mw
Temp space = 0.64Mw

Running in serial mode with 1 processor

 call bc3 [3]
 iqf0  44 ioffset  -1 i1  1
 i2  1 ne  1 i3  1

Program received signal SIGSEGV, Segmentation fault.
0x120018914 in bc3_ (i3=0x1fffe3b4, idim1=0x1fffeb0c, idim2=0x1fffeb10, 
    idim3=0x1fffeb14, nspec=0x20453590, nnev=0x204535b0, neqn=0x204535d0, 
    q=0x55976010, s3=0x559f63a0, vol=0x559d9390, dd30=0x55a27720, 
    dd3d=0x55a27720, ibccoef=0x20450ee0, rbccoef=0x204538c0, ibc3=0x0, 
    rbc3=0x0, qinf=0x20453cb0, pgauge=0x1ffff7a8, itherm=0x20453950, 
    ithch=0x20453bf0, ithcoef=0x20453990, rthcoef=0x204539d0, iliu=0x1fffede0, 
    rliu=0x1fffede8, ivscoef=0x20451b90, rvscoef=0x20453780, 
    refqty=0x20453ce0, vort=0x55a2afc0, t=0x55a2edc0) at front.F:1902
1902	              pubar = q(i1,i2,ne,i3-2)
Current language:  auto; currently fortran
(gdb) quit
---------------------- End of Gdb output -------------------------------

!!!!! Below is the source code where the error occurred.  I have flagged 
!!!!! the specific line for you.  I broke the original error line in
!!!!! half to isolate the bug.  The original line was:
!!!!!
!!!!!            t(iqf0 + ioffset + i1) = q(i1,i2,ne,i3-2)

------------------ Subroutine generating error ------------------------- 
c
c +--------------------------------------------------------------------+
c |                              BC3                                   |
c | Purpose: Main driver to calculate boundary conditions              |
c |          Gathers values of primative variables and associated      |
c |          metrics for the i3=0 and idim3 boundaries.                |
c +--------------------------------------------------------------------+
c
      subroutine bc3(i3,idim1,idim2,idim3,nspec,nnev,neqn,
     .               q,s3,vol,dd30,dd3d,
     .               ibccoef,rbccoef,ibc3,rbc3,qinf,
     .               pgauge,itherm,ithch,ithcoef,rthcoef,iliu,rliu,
     .               ivscoef,rvscoef,refqty,vort,t)
c
c     inputs to routine
c
      INTEGER i3,idim1,idim2,idim3,nspec,nnev,neqn
      REAL q(-1:idim1+1,-1:idim2+1,neqn,i3-2:i3+2),
     .     s3(idim1-1,idim2-1,5,i3-1:i3+2),
     .     vol(idim1-1,idim2-1,i3-2:i3+2),
     .     dd30(idim1-1,idim2-1,i3-1:i3+1),
     .     dd3d(idim1-1,idim2-1,i3-1:i3+1)
c
c     coefficients for boundary conditions
c
      INTEGER ibc3(idim1-1,idim2-1,NIBC,2)
      REAL    rbc3(idim1-1,idim2-1,NRBC,2)
c
      INTEGER ibccoef(NIBCCOEF)
      REAL    rbccoef(NRBCCOEF)
c
c     reference quantities
c
      REAL    refqty(NREFQTY)
      REAL    pgauge,qinf(neqn)
c
c     coefficients for the thermodynamics 
c
      INTEGER itherm,ithch(NITHCH)
      INTEGER ithcoef(nspec,NITHCOEF),iliu(1)
      REAL    rthcoef(nspec,NRTHCOEF),rliu(1)
c
c     two-equation turbulence
c
      INTEGER ivscoef(NIVSCOEF)
      REAL    rvscoef(NRVSCOEF)
      REAL    vort(0:idim1,0:idim2)
c
c     temporary space
c
      REAL    t(1)
c 
c     local variables
c     
      REAL pubar
      REAL sbt(4),volt,ddt,vortt
      INTEGER i1m1,i2m1,iqt0,iqt1,iqt2,iqt3,irbct,iqf0,iqf1,iqf2,
     .        itmp,ne,isf,ivol,ithp1,ithp2,itrp,idd,ivort,
     .        nlen,i1,i2,iqf3,ioffset,nsf
c
c     Set up offsets into the t array 
c
      i1m1=idim1-1
      i2m1=idim2-1
c
      nlen = i1m1*i2m1
c
      iqt0  = 1
      iqt1  = iqt0  + neqn
      iqt2  = iqt1  + neqn
      iqt3  = iqt2  + neqn
      irbct = iqt3  + neqn*2
      iqf0  = irbct + NRBC
      iqf1  = iqf0  + nlen*neqn
      iqf2  = iqf1  + nlen*neqn
      iqf3  = iqf2  + nlen*neqn
      isf   = iqf3  + nlen*neqn
      ivol  = isf   + nlen*4
      ithp1 = ivol  + nlen
      ithp2 = ithp1 + nlen*NTHP
      itrp  = ithp2 + nlen*NTHP
      idd   = itrp  + nlen*NTRP
      ivort = idd   + nlen
      itmp  = ivort  + nlen
c
      if(i3 .le. 2) then
c
c       I30 boundary 
c
        pubar=-1.0
c
        do 100 ne=1,neqn
          do 100 i2=1,i2m1
            ioffset = (ne-1)*i1m1*i2m1 + (i2-1)*i1m1 - 1
            do 100 i1=1,i1m1
c delete
        write(6,*) 'iqf0 ',iqf0,' ioffset ',ioffset,' i1 ',i1
	write(6,*) 'i2 ',i2,' ne ',ne,' i3 ',i3
              t(iqf0 + ioffset + i1) = pubar
              pubar = q(i1,i2,ne,i3-2)             <------ Error occurred here.
              t(iqf0 + ioffset + i1) = q(i1,i2,ne,i3-2)
              t(iqf1 + ioffset + i1) = q(i1,i2,ne,0)
              t(iqf2 + ioffset + i1) = q(i1,i2,ne,1)
              t(iqf3 + ioffset + i1) = q(i1,i2,ne,2)
 100    continue
 ...
 ...
--------------------- End of error subroutine --------------------- 

!!!!! Below is the source code that called the subroutine where the
!!!!! error occurred. 'call bc3' is where the error subroutine was
!!!!! called.  This is at the end of the code below.

----------------- Code calling error subroutine ------------------- 
      subroutine initzone(imode,izone,iblock,idim1,idim2,idim3,
     .                    nspec,nnev,neqn,istor1,istor2,
     .                    istmet1,istmet2,iplstt,iplend,iplswp,
     .                    q,xyz,s1,s2,s3,vol,dd10,dd1d,dd20,dd2d,
     .                    dd30,dd3d,wall30,wall3d,ibccoef,rbccoef,
     .                    ibc1,ibc2,ibc3,
     .                    rbc1,rbc2,rbc3,qinf,pgauge,itherm,ithch,
     .                    ithcoef,rthcoef,iliu,rliu,ivisflx,ivscoef,
     .                    rvscoef,refqty,t)
c     inputs to routine
c
      INTEGER imode(NIMODE),iblock(NIBLOCK),izone(NIZONE)
c
      INTEGER idim1,idim2,idim3,nspec,nnev,neqn
c
      INTEGER istor1,istor2,istmet1,istmet2,iplstt,iplend,iplswp
c
      REAL q((idim1+3)*(idim2+3)*neqn,istor1-2:istor2+2),
     .     xyz(idim1*idim2*3,istor1-1:istor2+2),
     .     s1(idim1*(idim2-1)*5,istmet1-1:istmet2+1),
     .     s2((idim1-1)*idim2*5,istmet1-1:istmet2+1),
     .     s3((idim1-1)*(idim2-1)*5,istmet1-1:istmet2+2),
     .     vol((idim1-1)*(idim2-1),istor1-2:istor2+2)
c
c     directed distances
c
      REAL    dd10(idim1*(idim2-1),istmet1-1:istmet2+1),
     .        dd1d(idim1*(idim2-1),istmet1-1:istmet2+1),
     .        dd20(idim2*(idim1-1),istmet1-1:istmet2+1),
     .        dd2d(idim2*(idim1-1),istmet1-1:istmet2+1),
     .        dd30((idim1-1)*(idim2-1),istmet1-1:istmet2+1),
     .        dd3d((idim1-1)*(idim2-1),istmet1-1:istmet2+1)
c
      REAL    wall30(idim1-1,idim2-1,3),wall3d(idim1-1,idim2-1,3)
c
c     coefficients for boundary conditions
c
      INTEGER ibccoef(NIBCCOEF)
      REAL    rbccoef(NRBCCOEF)
c
      INTEGER ibc1(idim2-1,idim3-1,NIBC,2),
     .        ibc2(idim3-1,idim1-1,NIBC,2),
     .        ibc3(idim1-1,idim2-1,NIBC,2)
      REAL    rbc1(idim2-1,idim3-1,NRBC,2),
     .        rbc2(idim3-1,idim1-1,NRBC,2),
     .        rbc3(idim1-1,idim2-1,NRBC,2)
c
c     reference quantities
c
      REAL    refqty(NREFQTY)
      REAL    pgauge,qinf(neqn)
c
c     coefficients for the thermodynamics
c
      INTEGER itherm,ithch(NITHCH)
      INTEGER ithcoef(nspec,NITHCOEF),iliu(1)
      REAL    rthcoef(nspec,NRTHCOEF),rliu(1)
c
c     two-equation turbulence
c
      INTEGER ivisflx(NIVISFLX),ivscoef(NIVSCOEF)
      REAL    rvscoef(NRVSCOEF)
c
c     temporary space
c
      REAL    t(1)
c
      INTEGER ishuf,ialpha1,ialpha2,ivort,itmp,i3,ipass
c
      ialpha1 = 1
      ialpha2 = 1
      ivort = 1
      itmp = ivort + (idim1+1)*(idim2+1)
c
      ishuf = 0
      if(imode(MemoryMode) .ne. HIGH_MEM) then
c
c       calculating metrics on the fly,
c       so set up the first planes worth
c
        call shfmet(idim1,idim2,idim3,iplstt,iplstt,ishuf,
     .              xyz(1,iplstt-1),s1,s2,s3,
     .              dd10,dd1d,dd20,dd2d,dd30,dd3d,
     .              ibccoef,t(itmp))
c
      end if
c
      if(iblock(Marching) .ne. FALSE) then
c
c       Space Marching
c
c       if this is the first cycle and space marching
c       and the current zone needs to be initialized with the
c       previous plane, do it here
c
        if(izone(ZoneInitPlane) .eq. TRUE) then
c
c         only do boundary conditions in marching direction
c
          call bc3(iplstt,idim1,idim2,idim3,nspec,nnev,neqn,
     .             q(1,iplstt-2),s3(1,iplstt-1),vol(1,iplstt-2),
     .             dd30(1,iplstt-1),dd3d(1,iplstt-1),ibccoef,
     .             rbccoef,ibc3,rbc3,qinf,pgauge,itherm,ithch,ithcoef,
     .             rthcoef,iliu,rliu,ivscoef,rvscoef,refqty,
     .             t(itmp),t(itmp))
c
          call qfill(idim1,idim2,neqn,q(1,iplstt-1))
c
          izone(ZoneInitPlane) = FALSE
c
        end if
c
      else
c
c       Global Iteration
c
c       set up the shift parameter
c       for the shuffle of metrics and thp's
c
        ishuf = iplswp
c
        do 100 i3 = iplstt,iplend,iplswp
c
c         first find out which index to pass for the metrics
c
          if(imode(MemoryMode) .eq. HIGH_MEM) then
            ipass = i3
          else
            ipass = 1
          end if
c
c         update the boundary conditions
c
          call wmag(i3,idim1,idim2,idim3,nspec,neqn,
     .              q(1,i3-2),s1(1,ipass),s2(1,ipass),
     .              s3(1,ipass),vol(1,i3-1),ibccoef,rbccoef,
     .              rbc1,rbc2,rbc3,ivisflx,t(ivort),
     .              t(itmp))
c
          if(ibccoef(ImplicitBC) .eq. FALSE) then
c
            call bc12(i3,idim1,idim2,idim3,nspec,nnev,neqn,q(1,i3),
     .                s1(1,ipass),s2(1,ipass),vol(1,i3),dd10(1,ipass),
     .                dd1d(1,ipass),dd20(1,ipass),dd2d(1,ipass),
     .                ibccoef,rbccoef,ibc1,ibc2,rbc1,rbc2,qinf,
     .                pgauge,itherm,ithch,ithcoef,rthcoef,iliu,rliu,
     .                ivscoef,rvscoef,refqty,t(ivort),t(itmp))
c
          endif
c
          write(6,*) 'call bc3 [3]'
          call bc3(i3,idim1,idim2,idim3,nspec,nnev,neqn,
     .             q(1,i3-2),s3(1,ipass-1),vol(1,i3-2),dd30(1,ipass-1),
     .             dd3d(1,ipass-1),ibccoef,rbccoef,ibc3,rbc3,
     .             qinf,pgauge,itherm,ithch,ithcoef,rthcoef,iliu,rliu,
     .             ivscoef,rvscoef,refqty,t(ivort),t(itmp))
c
...
...
----------------- End of code calling error subroutine -------------------

I'm hoping this is a known bug.  I'm prepare to provide what ever additional 
information you need if you're willing to solve this bug.

                              Thank You!

			      Gary Allen



More information about the Gcc-bugs mailing list