This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: g77 bug (SAVE "skiped")


> Do you have a (preferrably small) source example that shows what problem
> you have ?
I am just porting some king of a fortran package to Linux.
Analysis of a core dump has led me to the conclusion that the "SAVE" is
not taken into account. The piece of code was :
---------------------------------------------------------
      SUBROUTINE SELJ1(XTIL)
C--------------------------------------------------------
C SUBNAME= SELJ1                        B.COLBORN
C--------------------------------------------------------
      SAVE
      REAL*8 RNDM
      DIMENSION A(19),SUMA(19),X(19)
      DATA IFIRST /0/
      IF (IFIRST .EQ. 12345) GO TO 100
C         INITIATION PATH
      IFIRST = 12345
      ISIZE = 19
      X(1) = 0.
      DELTAX= .2
...
C        SELECT IPRIM
  100 R = RNDM()
...
---------------------------------------------------------
Note that the IFIRST is initialized to 0 in the DATA statement, while the
ISIZE and DELTAX are not. After the first call to this routine the IFIRST
should be 12345 (never changed in the routine again), while the ISIZE
should be 19 and the DELTAX should be 0.2 (both never changed in the
routine). I have found that the IFIRST was preserved, while the ISIZE and
DELTAX were NOT (the values were just "random"). After I added the
"-fno-automatic" there was no core dump any more.
So my conclusion was that the variable that was initialized by the DATA
statement was "static", while all other were "automatic".
Looking at this piece of code I just noticed that both ISIZE and DELTAX
are NOT declared (I mean there is no "INTEGER ISIZE", "REAL DELTAX"), so
maybe there's the problem - I haven't checked A, SUMA, X which are
declared (in the DIMENSION statement). Maybe they are really static ?
Best regards,
Jacek.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]