Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Catherine Rees Lay <Catherine@reeslay.demon.co.uk>
Subject: Re: Mysterious data corruption in Fortran with -automatic
Date: 1998/06/05	[thread overview]
Message-ID: <IG+01JAFMAe1EwcP@reeslay.demon.co.uk> (raw)
In-Reply-To: 01bd9038$56a0f7c0$LocalHost@stupidwin95


In article <01bd9038$56a0f7c0$LocalHost@stupidwin95>, "Kevin G. Rhoads"
<T_Rhoads@NoSpam.CLASSIC.MSN.COM> 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



  reply	other threads:[~1998-06-05  4:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-04  4:00 Mysterious data corruption in Fortran with -automatic Keith Refson - real email address in signature
1998-06-04  4:00 ` Thorsten Ohl
1998-06-04  4:00 ` Kevin G. Rhoads
1998-06-04  4:00   ` Jeffrey J. Potoff
1998-06-04  4:00     ` Stuart Brook
1998-06-04  4:00       ` Kevin G. Rhoads
1998-06-05  4:00         ` Stuart Brook
1998-06-05  4:00       ` Toon Moene
1998-06-04  4:00     ` Kevin G. Rhoads
1998-06-05  4:00       ` Keith Refson - real email address in signature
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-05  4:00         ` Robert O'Dowd
1998-06-05  4:00           ` Kevin G. Rhoads
1998-06-05  4:00           ` John Appleyard
1998-06-05  4:00             ` Keith Refson - real email address in signature
1998-06-05  4:00       ` Robert O'Dowd
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-05  4:00           ` Jeffrey J. Potoff
1998-06-05  4:00           ` Stuart Brook
1998-06-05  4:00       ` Jeffrey J. Potoff
1998-06-05  4:00       ` Harald Anlauf
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-08  4:00       ` Paul Winalski
1998-06-04  4:00     ` Kevin G. Rhoads
1998-06-05  4:00       ` Catherine Rees Lay [this message]
1998-06-04  4:00     ` Kevin G. Rhoads
1998-06-05  4:00       ` Ian Chivers
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-05  4:00       ` Ian Pattie
1998-06-05  4:00         ` Jeffrey J. Potoff
1998-06-05  4:00           ` Kevin G. Rhoads
1998-06-06  4:00           ` Rob Komar
1998-06-05  4:00       ` William Clodius
1998-06-05  4:00       ` Thorsten Ohl
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-05  4:00           ` William Clodius
1998-06-06  4:00 ` SUMMARY: Code errors which can masquerade as compiler bugs " Kevin G. Rhoads
1998-06-11  4:00   ` Ron Sverdlove x2517
1998-06-08  4:00 ` Steve Lionel
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox