From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,cf4ba3d07912d446 X-Google-Attributes: gid1164f8,public X-Google-Thread: 1094ba,cf4ba3d07912d446 X-Google-Attributes: gid1094ba,public From: Catherine Rees Lay Subject: Re: Mysterious data corruption in Fortran with -automatic Date: 1998/06/05 Message-ID: #1/1 X-Deja-AN: 360973373 References: <01bd9013$76f09aa0$6f242499@stupidwin95> <35774C1A.2985A59E@rhea.umd.edu> <01bd9038$56a0f7c0$LocalHost@stupidwin95> MIME-Version: 1.0 Distribution: world X-NNTP-Posting-Host: reeslay.demon.co.uk:194.222.76.21 X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 897388603 nnrp-03:1912 NO-IDENT reeslay.demon.co.uk:194.222.76.21 Organization: Catherine Rees Lay Newsgroups: comp.sys.dec,comp.lang.fortran In article <01bd9038$56a0f7c0$LocalHost@stupidwin95>, "Kevin G. Rhoads" writes >>I disagree. Most likely you have hit a 'bug', but it's not the >>compiler that's the problem, it's the code itself. For well >>written code you can compile it with *any* flags on *any* platform >>and it still runs without incident. > >When something adds 2 + 2 and gives me -123e+78, >it is the compiler which has OVER-optimized the code >to the point where it is generating garbage. > I agree absolutely. But consider the following case: PROGRAM TEST CALL SUB(1) CALL SUB(2) END SUBROUTINE SUB(I) INTEGER I,J,K IF (I.EQ.1) J=2 K = J + J RETURN END (please excuse old-style F77). It's perfectly possible that many compilers at different levels of optimisation will have K=4 from the second call to SUB. Yes, 2+2 always = 4. But K = -123e+78 from the above example would not be an optimiser bug. I've also run into this when compiling code as a DLL rather than an EXE, with the same (or no) optimisation in both cases. (I'd point out that this was not with a DEC compiler.) Catherine. -- Catherine Rees Lay