Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Jeffrey J. Potoff" <jpotoff@rhea.umd.edu>
Subject: Re: Mysterious data corruption in Fortran with -automatic
Date: 1998/06/04	[thread overview]
Message-ID: <35774C1A.2985A59E@rhea.umd.edu> (raw)
In-Reply-To: 01bd9013$76f09aa0$6f242499@stupidwin95


Kevin G. Rhoads wrote:
> 
> Keith - first, thanks so very much for MOLDY.
> 
> Re data corruption -- I believe the key is later in your
> post where you say:
> "I should mention that this is compiled with "-g -O2 -automatic" -- the
> problem goes away at lower optimization levels."
> This really sounds like an optimizer bug.
> 
> "More mysteriously exactly the same behaviour is observed
> when the code is compiled with f90 instead of f77" not
> mysterious if they are from the same vendor, in which case
> they likely share the same back-end, where all the low level
> optimizations are performed.
> 
> I have found that on non-trivial code (anything with more than
> a few thousand lines), whether it be C or Fortran, that you
> are fairly likely to hit some optimizer bug.  Numerical computations
> tend to be the most likely to trigger optimizer bugs (just my personal
> experience, not from any studies).

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.

> 
> I have made it a rule for some years now to compile EVERYTHING
> with optimizations off as well as on and compare the results of
> standard test runs.  This last year I have been bumping into a new
> optimizer bug roughly once every other month.  (Of course, I have
> been running the code through three different vendor's Fortran
> compilers and six different vendor's C compilers.)

This is always a good idea.  If you don't get the same answers, you
know there's a bug in your code. 

> 
> If it is an optimizer bug, the only long-term fix is getting
> a corrected compiler from the vendor.  In the short-term,
> since you've found that putting in debugging writes clears
> the problem up, may I humbly suggest that opening a NULL
> device for output and leaving those WRITEs in, but directed to
> NULL, may be a useable work-around

Bad idea.  Usually this is just masking some bug in your code.

 (with, of course, suitably
> scathing comments about the sloppiness of the compiler vendor's
> coders and Q/A testing . . .  ;-)  )

Uh huh, or more appropriately the sloppiness of the person who
wrote the code to begin with.

Jeff



  reply	other threads:[~1998-06-04  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 [this message]
1998-06-04  4:00     ` Kevin G. Rhoads
1998-06-05  4:00       ` Harald Anlauf
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-05  4:00       ` Jeffrey J. Potoff
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           ` Stuart Brook
1998-06-05  4:00           ` Jeffrey J. Potoff
1998-06-08  4:00       ` Paul Winalski
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       ` Thorsten Ohl
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-05  4:00           ` William Clodius
1998-06-05  4:00       ` William Clodius
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       ` Ian Chivers
1998-06-05  4:00         ` Kevin G. Rhoads
1998-06-04  4:00     ` Kevin G. Rhoads
1998-06-05  4:00       ` Catherine Rees Lay
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