Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00 Mysterious data corruption in Fortran with -automatic Keith Refson - real email address in signature
@ 1998-06-04  4:00 ` Kevin G. Rhoads
  1998-06-04  4:00   ` Jeffrey J. Potoff
  1998-06-04  4:00 ` Thorsten Ohl
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-04  4:00 UTC (permalink / raw)



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 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.)

Now most of my coding these days is on x86/Wintel platforms, 
and if you are using workstations I expect the compilers are 
much more solid.  But, even so, there will be optimizer bugs.

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 (with, of course, suitably
scathing comments about the sloppiness of the compiler vendor's
coders and Q/A testing . . .  ;-)  )  Alternatively turn off some 
of the optimizations for the module in question. 
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00 ` Kevin G. Rhoads
@ 1998-06-04  4:00   ` Jeffrey J. Potoff
  1998-06-04  4:00     ` Stuart Brook
                       ` (3 more replies)
  0 siblings, 4 replies; 39+ messages in thread
From: Jeffrey J. Potoff @ 1998-06-04  4:00 UTC (permalink / raw)



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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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       ` Toon Moene
  1998-06-04  4:00     ` Kevin G. Rhoads
                       ` (2 subsequent siblings)
  3 siblings, 2 replies; 39+ messages in thread
From: Stuart Brook @ 1998-06-04  4:00 UTC (permalink / raw)



Jeffrey J. Potoff wrote:
> 
> 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
-------
And did I see mention of compiling a module with several thousand lines
of code ?  That is an invitation to disaster compiling that much code in
a single module.



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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       ` Robert O'Dowd
                         ` (4 more replies)
  1998-06-04  4:00     ` Kevin G. Rhoads
  1998-06-04  4:00     ` Kevin G. Rhoads
  3 siblings, 5 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-04  4:00 UTC (permalink / raw)



Please read what I wrote and respond to that.

If the code gives CORRECT answers with compiler
optimizations OFF and it gives WRONG answers
with compiler optimizations ON -- question, where 
is the bug?

Answer, in the compiler optimizations -- the code
did NOT change, the compiler did.
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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
  1 sibling, 1 reply; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-04  4:00 UTC (permalink / raw)



Please read what was written and respond to that.

Several thousand line PROGRAMS were mentioned,
nowhere was it said that those were SINGLE SOURCE
MODULE programs.

So put your prejudices aside, and reply only to WHAT 
WAS ACTUALLY WRITTEN, PLEASE!
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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-04  4:00     ` Kevin G. Rhoads
  1998-06-05  4:00       ` Catherine Rees Lay
  1998-06-04  4:00     ` Kevin G. Rhoads
  3 siblings, 1 reply; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-04  4:00 UTC (permalink / raw)



>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.  

If you were to say, that well written code SHOULD be able
to be compiled with any flags on any platform and run
with correct output, then I would agree.  I have seen TOO
many cases where the COMPILER is in error.  

I don't trust my code.
I don't trust the compiler's libraries.
I don't trust the compiler's code generator.
I try my best to VERIFY all of these.

If something screwy happens, I check my code
first.  But I don't continue assuming it is my
problem forever.  I also check to see if the
problem changes or goes away if I change
platforms, compilers and compiler settings.

Even if it is an error in my code, changing
these other things can provide useful information
helping to locate the problem.

But when my code compiles cleanly under 6
different compilers.  And it generates the same
output from the exes from 5 of those compilers
no matter what settings I use in any of those five
compilers, but with the exe from the sixth compiler
it sometimes works fine but when compiled with
other settings it produces total garbage -- that is
fairly solid evidence that compiler number 6 has
a bug.  

I have been programming for over 30 years,
and I have seen a fair number of compiler bugs.

If you have tools sets whose quality justifies
your unreserved faith in their correctness,
you are lucky!

As for me, I trust, but I verify.
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00   ` Jeffrey J. Potoff
                       ` (2 preceding siblings ...)
  1998-06-04  4:00     ` Kevin G. Rhoads
@ 1998-06-04  4:00     ` Kevin G. Rhoads
  1998-06-05  4:00       ` Thorsten Ohl
                         ` (3 more replies)
  3 siblings, 4 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-04  4:00 UTC (permalink / raw)



Dear Jeffrey:

All of what you've said boils down to
>you must be writing buggy code<
asserted with 
NO justification, based on what was posted
NO reasoning or evidence offered in support

Would you care to offer some substantive
suggestions, data, or references?

I fail to see how anyone can reasonable
suggest that when code 
compiles cleanly, with neither error NOR WARNING
and produces two wildly different results
depending ONLY on the compiler settings
that it MUST be bugs in the code,
and the compiler is necessarily faultless.

Are you just flaming?  Or do you have some
justification you are not sharing with the rest 
of us?
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Mysterious data corruption in Fortran with -automatic
@ 1998-06-04  4:00 Keith Refson - real email address in signature
  1998-06-04  4:00 ` Kevin G. Rhoads
                   ` (3 more replies)
  0 siblings, 4 replies; 39+ messages in thread
From: Keith Refson - real email address in signature @ 1998-06-04  4:00 UTC (permalink / raw)



I have just wasted about 3 days attempting to debug a really
mysterious problem with a FORTRAN program on DU 4.0D.  The original
problem is that the program gives different results when compiled with
the "-automatic" flag to put variables on the stack.

However irrespective of any bugs in the program I have narrowed the
focus to one particular segment of code which is behaving in an
inexplicable manner.  Namely: a computed result is wrong - as deduced
from extra debugging "write" statements"  Yet when I add a "write"
statement to print the disputed value, both it and the final result
are now correct.    The code looks like:

      DO 1100 NI=1,NIONSP(NSP)
      DO 1101 IM=1,3
      POSTMP(IM)=MOD(10.D0+POSION(IM,NI,NSP),1.D0)  
 1101 CONTINUE
c      write(6,9999) postmp
c 9999  format(3f10.5)
      NGRPX=1+NINT(NGX*POSTMP(1))
      NGRPY=1+NINT(NGY*POSTMP(2))
      NGRPZ=1+NINT(NGZ*POSTMP(3))

Using the debugger on the immediately following statement yeilds:

(ladebug) p postmp
(1) 10.033126
(2) 0.0127600000000001
(3) 0.03312599999999932

(ladebug) p posion(1,1,1)
0.009953999999999999
(ladebug) p posion(2,1,1)
0.01276
(ladebug) p posion(3,1,1)
0.033126
(ladebug) next

I should mention that this is compiled with "-g -O2 -automatic" -- the
problem goes away at lower optimization levels. I'm fairly sure
that this erroneous value in postmp(1) IS being stored and used later
on - even if the array postmp is being optimized away since later
results are consistent with use of the erroneous value.

I had to step on a fair way before the optimized code thought it had
finished with that block of code, after which:
 
(ladebug) p ngrpx,ngrpy,ngrpz
503 1 2

The values of NGX,Y,Z=50,32,27 so this is consistent however postmp
has changed suggesting that it is register allocated or otherwise
optimzed away.


(ladebug) p postmp
(1) 0.03312599999999932
(2) 4.940656458412465e-323
(3) 0.03312599658966064

As I mentioned before, uncommenting the "write" statement both prints
out the correct value and fixed the problem.

I can't see any way this could be a bug in the code. Obviously I have
checked for array bounds problems, uninitialized variables and found
nothing.  More mysteriously exactly the same behaviour is observed
when the code is compiled with f90 instead of f77.   This is a verly
large code needing about 300MB of variable space (stack or data) to
run, and of course I have configured the kernel with sufficient
stack/data limits etc for the data.

A Deja news search revealed a 1996 article by Toon Moene 

Subject:      Stack allocation hosed in Digital Unix 3.2C ?
From:         toon@moene.indiv.nluug.nl (Toon Moene)
Date:         1996/02/02
Message-ID:   <1057@moene.indiv.nluug.nl>
and Message-ID:   <1058@moene.indiv.nluug.nl>

where he described a similar-sounding problem caused by a machine
configuration error as shipped by Digital, namely the value of the
"stackinc" kernel symbol.  kdbx reveals it still (in 4.0D) has the
value he thought was wrong, namely 32767.  However upping it has
made no difference.

Has anyone encountered a similar problem and/or know of a fix?

sincerely

Keith Refson


-- 
------------------------------------------------------------------------------
Email: Keith.Refson@  | Tel: +44 1865 272026 | Dr Keith Refson,              |
       earth.ox.ac.uk | Fax: +44 1865 272072 | Dept of Earth Sciences        |
                                             | Parks Road, Oxford OX1 3PR, UK|
------------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00 Mysterious data corruption in Fortran with -automatic Keith Refson - real email address in signature
  1998-06-04  4:00 ` Kevin G. Rhoads
@ 1998-06-04  4:00 ` Thorsten Ohl
  1998-06-06  4:00 ` SUMMARY: Code errors which can masquerade as compiler bugs " Kevin G. Rhoads
  1998-06-08  4:00 ` Steve Lionel
  3 siblings, 0 replies; 39+ messages in thread
From: Thorsten Ohl @ 1998-06-04  4:00 UTC (permalink / raw)



rubber@bounce.com (Keith Refson - real email address in signature) writes:

> I can't see any way this could be a bug in the code. Obviously I
> have checked for array bounds problems, uninitialized variables and
> found nothing.  More mysteriously exactly the same behaviour is
> observed when the code is compiled with f90 instead of f77.

From your symptoms, there is a 99.99% chance, that you have forgotten
to SAVE local variables that are supposed to keep their values across
invocations of a procedure.

Legacy code is typically full of such problems, because many Fortran
compilers used to SAVE by default and programmers forgot to SAVE.
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://crunch.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
  1998-06-05  4:00       ` Robert O'Dowd
  1998-06-05  4:00       ` Keith Refson - real email address in signature
@ 1998-06-05  4:00       ` Jeffrey J. Potoff
  1998-06-05  4:00       ` Harald Anlauf
  1998-06-08  4:00       ` Paul Winalski
  4 siblings, 0 replies; 39+ messages in thread
From: Jeffrey J. Potoff @ 1998-06-05  4:00 UTC (permalink / raw)



Kevin G. Rhoads wrote:
> 
> Please read what I wrote and respond to that.
> 
> If the code gives CORRECT answers with compiler
> optimizations OFF and it gives WRONG answers
> with compiler optimizations ON -- question, where
> is the bug?
>

In your code.
 
> Answer, in the compiler optimizations -- the code
> did NOT change, the compiler did.

The way the program accesses memory will change due to the
optimization level (ie, the code gets reorganized).  If you
don't initialize your variables or pass them correctly to
subroutines the optimized code can give incorrect results
or may not run at all.  Well written code will not suffer
from these problems.

Jeff



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00         ` Kevin G. Rhoads
  1998-06-05  4:00           ` Stuart Brook
@ 1998-06-05  4:00           ` Jeffrey J. Potoff
  1 sibling, 0 replies; 39+ messages in thread
From: Jeffrey J. Potoff @ 1998-06-05  4:00 UTC (permalink / raw)



Kevin G. Rhoads wrote:
> 
> Exactly.
> 
> I have no disagreement with that.
> 
> However, when responding to flamers
> who assert that all errors MUST be
> in the code ALL the time.  Who so flame
> without adding any useful information.
> I responded by streamlining the logic.
> 
> It was probably a mistake to try to simplify
> the logic to the level where a self-righteous,
> unhelpful flamer (such as Jeffery would appear
> to be, based upon his post above) could
> perhaps understand it.  But I did
> so simplify the logic and present it.

Feel better now ?  I hear people going on and on about
'compiler bugs' or 'the optimizer broke my code' when
99% of the time the bug is in the code.  Which is more
arrogant and self-righteous ?  Believing that the bug
*must* be in the optimizer or that your code is the 
source of the problem ?

> 
> So, yes, I agree.  The presence of errors
> which appear solely in response to increased
> optimization is NOT PROOF of a compiler
> bug.  It is merely evidence that may indicate
> several things.   And most of the things it
> can indicate are programmer errors or oversights.
> BUT, there comes a point, after one has tested
> the code, proof-read it repeatedly, asked fellow
> programmers to review it, tried multiple compilers
> with multiple settings and multiple debuggers and
> code testing tools -- somewhen, there comes a
> point at which checking for a bug in the optimizer
> is a reasonable thing to start doing.

If you really think it's a compiler bug there's no sense
screwing around, you call the folks at DEC (since this
is posted to comp.sys.dec I'm going to assume that's 
what you're talking about) and send the code to them.

BTW - Just what is the deal with this chip on your shoulder,
going on and on about 'flaming' ?  I didn't flame anyone,
I just stated that nearly all 'optimizer' bug are in reality
code bugs.  For some reason you've taken this very personally.
Sheesh, lighten up.  It's not like I'm talking trash about your
mother.

Jeff



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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
  0 siblings, 2 replies; 39+ messages in thread
From: Jeffrey J. Potoff @ 1998-06-05  4:00 UTC (permalink / raw)



Ian Pattie wrote:
> 
> Well, I agree with Kevin.  Jeffrey must be dealing with some pretty
> simple codes or something.

I write code in Fortran 90 for the Monte Carlo simulation of a 
variety of fluids.  Most of my work is in the critical behavior
of mixtures.  The codes are not terribly complex (at least not to
me), but can be quite long.  They all compile with whatever
optimization I choose and give me the exact same answers regardless
of optimization level.  All the codes I have written have always 
done that.  If they didn't, I knew there was a bug (almost always 
in memory allocation) in the code.

> 
> I can take 10 year old code, compile it with MS FPS (terrible, full
> of bugs, especially when using automatic)

Microsoft wrote a compiler, is it any suprise you found lots of bugs
in it ?

> and find optimization
> bugs, in corrrect code.  Lahey LF90 too (they finally just disabled
> their -o2 flag) and DVF.
>

Look, I never said that there are *NO* compiler bugs, but in *most*
cases bugs which appear due to higher optimization levels are due
to sloppy written code.
 
> In subroutines with 10 lines or 1000, it doesn't matter.  Five compilers
> will work fine, the 6th will stumble.  Of course your code is the
> first suspect, but in mature code that has worked fine for 10 years
> or so, I usually end up finding an optimization bug.

Worked fine on which platform with what platfrom specific extensions
written around which compiler ?  

Jeff



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00         ` Jeffrey J. Potoff
@ 1998-06-05  4:00           ` Kevin G. Rhoads
  1998-06-06  4:00           ` Rob Komar
  1 sibling, 0 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-05  4:00 UTC (permalink / raw)



>Look, I never said that there are *NO* compiler bugs, but in *most*
>cases bugs which appear due to higher optimization levels are due
>to sloppy written code.

True.  
The first thing to check is the code.  And the second and the third . . .
You start looking for compiler bugs after everything else has been
thoroughly checked.
 -- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
@ 1998-06-05  4:00       ` Catherine Rees Lay
  0 siblings, 0 replies; 39+ messages in thread
From: Catherine Rees Lay @ 1998-06-05  4:00 UTC (permalink / raw)



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



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
  1998-06-05  4:00       ` Robert O'Dowd
@ 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       ` Jeffrey J. Potoff
                         ` (2 subsequent siblings)
  4 siblings, 2 replies; 39+ messages in thread
From: Keith Refson - real email address in signature @ 1998-06-05  4:00 UTC (permalink / raw)



"Kevin G. Rhoads" <T_Rhoads@NoSpam.CLASSIC.MSN.COM> writes:


> If the code gives CORRECT answers with compiler optimizations OFF
> and it gives WRONG answers with compiler optimizations ON --
> question, where is the bug?

I know this seems like an obvious conclusion but I am afraid in my
(many years of) experience it is false.  One obvious way this might
happen is if you omitted to initialize a variable.  Compiling with no
optimization will often result in it being initialized to zero -- even
though you didn't ask for it in your code.  However the optimized code
will pick up whatever value was last in some register or memory
location and will therefore give different results.  Another mistake
is to pass the same actual argument twice to two different dummy
arguments in a subroutine.  The standard entitles the compiler to
assume that these refer to distinct areas of store and optimizing on
that assumption may not produce the results you intended.  Yet another
faulty but common assumption is that variables retain their values
between invocations of a subprogram.


> Answer, in the compiler optimizations -- the code did NOT change,
> the compiler did.


But incorrect code with "undefined" behaviour may yet produce
"correct" results.  Perhaps the language lawyers don't make this point
sufficiently clear.....

Nevertheless I believe the part of code that I am having trouble with
and started this thread about does *not* suffer from failure to
initialize, aliasing or assumptions of SAVE behaviour or array bounds
errors (at least not in the part where the faulty result occurs). Does
anyone have any further suggestions as to what to look for?  If not
then maybe this really is one of the relatively rare cases of a
genuine optimizer bug.

Keith refson



-- 
------------------------------------------------------------------------------
Email: Keith.Refson@  | Tel: +44 1865 272026 | Dr Keith Refson,              |
       earth.ox.ac.uk | Fax: +44 1865 272072 | Dept of Earth Sciences        |
                                             | Parks Road, Oxford OX1 3PR, UK|
------------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Stuart Brook
  1998-06-04  4:00       ` Kevin G. Rhoads
@ 1998-06-05  4:00       ` Toon Moene
  1 sibling, 0 replies; 39+ messages in thread
From: Toon Moene @ 1998-06-05  4:00 UTC (permalink / raw)



Stuart Brook <sbrook@concentric.net> wrote:

> And did I see mention of compiling a module with several thousand lines
> of code ?  That is an invitation to disaster compiling that much code in
> a single module.

But I bet Dfl 0.02 that the compiler is better able to track those thousands 
of lines than the average Fortran programmer :-)

-- 
Toon Moene (mailto:toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
g77 Support: mailto:fortran@gnu.org; NWP: http://www.knmi.nl/hirlam



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  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       ` Keith Refson - real email address in signature
                         ` (3 subsequent siblings)
  4 siblings, 1 reply; 39+ messages in thread
From: Robert O'Dowd @ 1998-06-05  4:00 UTC (permalink / raw)



Kevin G. Rhoads wrote:
> 
> Please read what I wrote and respond to that.
> 
> If the code gives CORRECT answers with compiler
> optimizations OFF and it gives WRONG answers
> with compiler optimizations ON -- question, where
> is the bug?
> 
> Answer, in the compiler optimizations -- the code
> did NOT change, the compiler did.

Ah, if the world was exactly that simple.

There are many things in language specs that are "undefined".
This means the compiler is free to to as it will on code
that invokes undefined behaviour.

A good optimiser will push the letter of the law with
the language, if by doing so it can improve performance
(however you measure "performance").  In doing so, it
could well change the results you get from the non-compliant
code.  Both results are consistent with the word "undefined
behaviour".
 
-<Automagically included trailer>
Robert O'Dowd                       Ph    +61 (8) 9553 3618
DSTO Bldg A51	                    Fax    +61 (8) 9553 3577
HMAS Stirling                       Email:
robert.odowd@dsto.defence.gov.au
Rockingham, Western Australia, 6958

Disclaimer: Opinions above are mine and may be worth what you paid for
them



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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           ` John Appleyard
  1998-06-05  4:00           ` Kevin G. Rhoads
  1 sibling, 2 replies; 39+ messages in thread
From: Robert O'Dowd @ 1998-06-05  4:00 UTC (permalink / raw)



Keith Refson - real email address in signature wrote:
>[Snip] 
> Nevertheless I believe the part of code that I am having trouble with
> and started this thread about does *not* suffer from failure to
> initialize, aliasing or assumptions of SAVE behaviour or array bounds
> errors (at least not in the part where the faulty result occurs). Does
> anyone have any further suggestions as to what to look for?  If not
> then maybe this really is one of the relatively rare cases of a
> genuine optimizer bug.
> 

Failure to initialise, aliasing, assumptions about SAVE, and array
bounds
errors anywhere in your complete program can cause faulty results.

Somewhere in this thread, I recall a mention that insertion of a
write() statement made the program produce correct results.

This is actually a danger sign;  it is a clear sign that some
part of memory is being incorrectly written to.  Inserting the
write statement simply changes the place that gets written to,
but doesn't do away with the bad behaviour.

Some things to look for

1)  failure to initialise, aliasing, save behaviour, or array
     bounds *anywhere* in your complete program (not just "in the
     part where the fault occurs").  One thing to look at is an
     array passed to a function, and falling off the end of that.

2)  If you pass a variable twice to a subprogram (e.g.
     CALL SUB(I,I)) make sure the called subprogram doesn't
     change both values --- particularly if the computations
     are complex.  While this behaviour does not always
     produce incorrect results, as far as the called module
     is concerned its arguments are aliased.

 
-<Automagically included trailer>
Robert O'Dowd                       Ph    +61 (8) 9553 3618
DSTO Bldg A51	                    Fax    +61 (8) 9553 3577
HMAS Stirling                       Email:
robert.odowd@dsto.defence.gov.au
Rockingham, Western Australia, 6958

Disclaimer: Opinions above are mine and may be worth what you paid for
them



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
                         ` (2 preceding siblings ...)
  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
  4 siblings, 1 reply; 39+ messages in thread
From: Harald Anlauf @ 1998-06-05  4:00 UTC (permalink / raw)



"Kevin G. Rhoads" <T_Rhoads@NoSpam.CLASSIC.MSN.COM> writes:

> If the code gives CORRECT answers with compiler
> optimizations OFF and it gives WRONG answers
> with compiler optimizations ON -- question, where 
> is the bug?
> 
> Answer, in the compiler optimizations -- the code
> did NOT change, the compiler did.

Your argument is not very convincing. I also second Thorsten's
suggestion:

	If your program gives correct results with optimization *and*
	-noautomatic, then the bug is almost always in the code.

This is my experience with foreign code.  YMMV.

-- 
Ciao,
-ha



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
                         ` (2 preceding siblings ...)
  1998-06-05  4:00       ` Ian Pattie
@ 1998-06-05  4:00       ` Ian Chivers
  1998-06-05  4:00         ` Kevin G. Rhoads
  3 siblings, 1 reply; 39+ messages in thread
From: Ian Chivers @ 1998-06-05  4:00 UTC (permalink / raw)
  To: Kevin G. Rhoads


Kevin G. Rhoads wrote:
> 
> Dear Jeffrey:
> 
> All of what you've said boils down to
> >you must be writing buggy code<
> asserted with
> NO justification, based on what was posted
> NO reasoning or evidence offered in support
> 
> Would you care to offer some substantive
> suggestions, data, or references?
> 
> I fail to see how anyone can reasonable
> suggest that when code
> compiles cleanly, with neither error NOR WARNING
> and produces two wildly different results
> depending ONLY on the compiler settings
> that it MUST be bugs in the code,
> and the compiler is necessarily faultless.
>

i've just finished marking course work for
1st and second year mechanical engineering degree
students.

in both cases i've had programs handed in that
generate the correct results on one platform.

i spend the time moving the programs to a second
platform and observe what happens. 

the programs generate the 'correct' results in
the 1st case purely because of initialisation
of variables to 0.

so even the correct results aren't a guarantee
of errors in the program.

> Are you just flaming?  Or do you have some
> justification you are not sharing with the rest
> of us?
> --
> Kevin G. Rhoads, Ph.D.
> T_Rhoads@NO_SPAM.Classic.MSN.COM
> KRhoads@NO_SPAM.CmpNetMail.com

this is not meant as a criticism just an example
of how difficult it is at times to be sure that
the program works correctly.

ian chivers
computer centre
king's college
london



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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
                         ` (2 subsequent siblings)
  3 siblings, 1 reply; 39+ messages in thread
From: Thorsten Ohl @ 1998-06-05  4:00 UTC (permalink / raw)



"Kevin G. Rhoads" <T_Rhoads@NoSpam.CLASSIC.MSN.COM> writes:

> All of what you've said boils down to >you must be writing buggy
> code< asserted with NO justification, based on what was posted NO
> reasoning or evidence offered in support

Without the original poster supplying complete code (the little
snippet that he posted is alread his interpretation of the bug) we can
do litte more than guessing.

> I fail to see how anyone can reasonable suggest that when code
> compiles cleanly, with neither error NOR WARNING and produces two
> wildly different results depending ONLY on the compiler settings
> that it MUST be bugs in the code, and the compiler is necessarily
> faultless.

Simple example: most people with prior exposure to C are prone to
writing things like

    if ((x /= 0) .and. (test_condition_assuming_x_not_0 (x))) then
       ....
    end if

since most compilers don't reorder boolean expressions, this bug will
not be noticed until you hit a compiler (like DEC's) that takes
advantage of Fortran's fredom to reorder booleans.  I have had this
(in numerous disguises) more than once.

> Are you just flaming?  Or do you have some justification you are not
> sharing with the rest of us?

Careful.  Forgetting to SAVE variables is a _very_ common mistake.  It
still happens occasionally to me and the response to the -automatic
switch is a smoking gun when a student shows up with this problem
[believe me: almost all do at one point in their career ...]

True anecdote:

    A few months back I tested a new fortran compiler on some old code
    that worked on IBMs with VM and MVS, on VAXen with VMS, and on more
    flavors of UNIX that I can remember.  Everywhere the results where
    (up to floating point differences) identical.
    
    The new compiler appeared to produce complete garbage and I was
    ready to blame the compiler.  Then I tried the -static switch (the
    opposite of -automatic on this compiler) and the code produced
    correct results.  Then it took very little time to track down a
    forgotten SAVE. 
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://crunch.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00         ` Robert O'Dowd
@ 1998-06-05  4:00           ` John Appleyard
  1998-06-05  4:00             ` Keith Refson - real email address in signature
  1998-06-05  4:00           ` Kevin G. Rhoads
  1 sibling, 1 reply; 39+ messages in thread
From: John Appleyard @ 1998-06-05  4:00 UTC (permalink / raw)



In article <3577C554.9F50B096@nonexistant.com>, Robert O'Dowd
<nospam@nonexistant.com> writes
>Keith Refson - real email address in signature wrote:
>>[Snip] 
>> Nevertheless I believe the part of code that I am having trouble with
>> and started this thread about does *not* suffer from failure to
>> initialize, aliasing or assumptions of SAVE behaviour or array bounds
>> errors (at least not in the part where the faulty result occurs). Does
>> anyone have any further suggestions as to what to look for?  If not
>> then maybe this really is one of the relatively rare cases of a
>> genuine optimizer bug.
>> 
>
>Failure to initialise, aliasing, assumptions about SAVE, and array
>bounds
>errors anywhere in your complete program can cause faulty results.
>
>Somewhere in this thread, I recall a mention that insertion of a
>write() statement made the program produce correct results.
>
>This is actually a danger sign;  it is a clear sign that some
>part of memory is being incorrectly written to.  Inserting the
>write statement simply changes the place that gets written to,
>but doesn't do away with the bad behaviour.
>

I totally agree about the dangers of uninitialised variables, array
bound errors and the like, and particularly about the incorrectness of
assuming that if it works with compiler A, but not with compiler B, then
compiler B is bugged - but...

... this one looks like a compiler bug to me.  I'd be happier if I knew
the value if POSTMP(1) and POSION before the assignment to NGRPX, but
subject to that, and taking into account the checks the author has made,
it's difficult to explain any other way.  I suppose NGRPX/Y/Z might be
aliased, or the optimiser might have reordered code so that something
with an aliasing implication was executed after the 1101 loop and before
you inspected POSTMP, but that's a long shot.

I have found bugs just like this, even down to the WRITE making it go
away.  The act of printing forces the optimiser to regularise things, so
values get put back where they belong.  One trick I used successfully
(on a completely different platform) was to pass the offending variable
to a subroutine which prints it, rather than printing directly.  However
you've already got the evidence using the debugger.  What does the
compiler vendor say?
-- 
John Appleyard             John@polyhedron.com      John@polyhedron.co.uk

Polyhedron Software Ltd.        
Programs for Programmers - QA, Compilers, Graphics

************ Visit our Web site on http://www.polyhedron.co.uk/ ************



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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
  1 sibling, 0 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-05  4:00 UTC (permalink / raw)



Keith 
Yes.

I did not want to start a flame war here.

But the first two respondents to my post in response to
your original, did the following:
They assumed it could NOT possibly be a compiler bug.
They pontificated without offering any useful information.
and
At least one had the gall to criticize my comments when 
his own made it clear HE HAD NOT READ THE POST
he was critisizing.

I responded sharply, and without my customary sets of
disclaimers.

NOW -- I do NOT claim that ALL bugs that appear
when optimizations are on 
MUST BE compiler bugs.

But I do re-affirm that I believe that bugs which appear
when optimizations are turned on MAY be compiler
bugs.

And after one has checked the code carefully for bugs,
there comes a point at which one has the right to start
suspecting the compiler!

Having dealt with some of your code, i.e., MOLDY,
and having actually READ your original post, I felt
fairly confident that you had thoroughly checked the
code in question for coding errors on your owm part.
Thus I felt it appropriate to suggest you consider 
the compiler's optimizer.

It really burns me that many people feel competent
to start flaming others without bothering to read 
what was written.  Your response, Keith, is well
thought out, contains useful information and
provides reasoning to support your position.

Some of the other responses seem to be generating
great quantities of heat without shedding the least
bit of light upon this subject!
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  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
  0 siblings, 2 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-05  4:00 UTC (permalink / raw)



Exactly.

I have no disagreement with that.

However, when responding to flamers
who assert that all errors MUST be
in the code ALL the time.  Who so flame 
without adding any useful information.
I responded by streamlining the logic.

It was probably a mistake to try to simplify
the logic to the level where a self-righteous,
unhelpful flamer (such as Jeffery would appear
to be, based upon his post above) could
perhaps understand it.  But I did
so simplify the logic and present it.

So, yes, I agree.  The presence of errors
which appear solely in response to increased
optimization is NOT PROOF of a compiler
bug.  It is merely evidence that may indicate
several things.   And most of the things it 
can indicate are programmer errors or oversights.
BUT, there comes a point, after one has tested
the code, proof-read it repeatedly, asked fellow
programmers to review it, tried multiple compilers
with multiple settings and multiple debuggers and
code testing tools -- somewhen, there comes a
point at which checking for a bug in the optimizer
is a reasonable thing to start doing.
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00         ` Robert O'Dowd
  1998-06-05  4:00           ` John Appleyard
@ 1998-06-05  4:00           ` Kevin G. Rhoads
  1 sibling, 0 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-05  4:00 UTC (permalink / raw)



>This is actually a danger sign;  it is a clear sign that some
>part of memory is being incorrectly written to.  Inserting the
>write statement simply changes the place that gets written to,
>but doesn't do away with the bad behaviour.

Well it can do that, BUT inserting a write can also--
-change the use-tagging for variables referenced
-can cause additional components of the run-time library to be linked in
-can shift a variable from automatically register allocated into storage
('cause it has to be passed to  . . . in the RTL)
-can trigger shifts of code from local to distant (N.B. - this is 
NOT just an x86 perversion, the 68k family (for example) has 
16 bit offset instructions that are often used to save 2 bytes of 
address and the corresponding bus-traffic delays --so that many 
68k targetting compilers had 64k limits on code in a "single" 
chunk, and any 32 bit machine which  offers 16 bit "local" 
addressing modes can have this issue)

And, in fact, for 
-compilers which arrange storage so that data is before code, 
-or use Harvard architecture (separate code and data address spaces) 
-or use segmented addressing,
inserting a write may well NOT change where the variables
are addressed or located.  

YES - Uninitialized variables can lead to all  sorts of intermittent
errors.  That's why many compilers have tests for this and while
such automatic testing is not perfect, it is something one should
habitually require one's code to pass.  

Similarly, all variables should be declared - which Fortran standards 
do not require, but many compilers offer the option to enforce.  

And depending upon the persistence of an unSAVEd variable
is (in essence) another variant of the uninitialized variable.  But
putting in a global SAVE (no variables specified) and trying
that variant periodically will help uncover this bug.
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00       ` Harald Anlauf
@ 1998-06-05  4:00         ` Kevin G. Rhoads
  0 siblings, 0 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-05  4:00 UTC (permalink / raw)



But this is NOT what the original flamer claimed.

His assertion was that the error MUST be in the code.

That is just as silly as asserting the error MUST be
the compiler.

I did not mean to assert either such silliness.

Although, in response to the ignorant, unhelpful
and totally lacking in substance or information
post made several posts back, I simplified
the reasoning so the flamer could (hopefully)
understand it.  In so doing I simplified it to
the point of error -- oversimplified to death.

You now, are guilty of the same:
>	If your program gives correct results with optimization *and*
>	-noautomatic, then the bug is almost always in the code.
It takes MORE information than just that.

If you had summarized that by asserting that when
-noautomatic or a 
global SAVE  
make purported optimizer bugs disappear that is
a strong sign of code bugs not optimizer bugs
then I would agree.  

But as stated, it is oversimplified and subject to
misinterpretation.  Just as was my response to
Jeffrey's flame.

So -- let me make clear --
AFTER the code has been carefully checked
(and more than once)
and preferably after the code has had a review
by other than it's author (not always possible)
and AFTER testing for 
uninitialized variables,  
non-persistent variables treated as persistent, 
parameter list mismatches or 
the same variable being passed by reference to two or more 
different formal parameters

and, if possible,
after testing the code on multiple platforms with
multiple compilers

then there comes a point when one has a reasonable
expectation that maybe there is a compiler bug and
that eventuality should be tested.

This is NOT the first thing to suspect.
Nor the second or third, but it does go on the
list of possibles!

Jeffery's post assert it NEVER appears on the list
of things to suspect and check, and in replying to
that silliness  I oversimplified.  

Suspicion of a compiler bug DOES belong in the
list of things to check -- but it should be WAY DOWN
the list.  
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00       ` Thorsten Ohl
@ 1998-06-05  4:00         ` Kevin G. Rhoads
  1998-06-05  4:00           ` William Clodius
  0 siblings, 1 reply; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-05  4:00 UTC (permalink / raw)



Let me begin by thanking you for supplying real
substantive feedback, which should be helpful to
all readers.  This is something that a few earlier
posters failed to do.

>> I fail to see how anyone can reasonable suggest that when code
>> compiles cleanly, with neither error NOR WARNING and produces two
>> wildly different results depending ONLY on the compiler settings
>> that it MUST be bugs in the code, and the compiler is necessarily
>> faultless.
>
>Simple example: 
Your example is excellent.  However, I must note it is an example of
how it CAN be a code bug not a compiler bug.  

The comment above was in response to the (implied) assertion that
it MUST be a code bug.  
I never claimed it COULD NOT be a code bug, 
I stand by what I have posted before, in context --
this kind of behavior indicates THE POSSIBILITY 
of a compiler bug 
and 
to assert that it ONLY results from code bugs is WRONG.

As I have clarifed elsewhere, checking for compiler bugs is
way down the to-do list.  But when one has checked for
code bugs and PREFERABLY had an independent code
review (because it is impossible to properly proof-read what
one has written oneself), and ...  and ... and  ...
There comes a time to suspect the compiler.

>> Are you just flaming?  Or do you have some justification you are not
>> sharing with the rest of us?
>
>Careful.  Forgetting to SAVE variables is a _very_ common mistake. 
Again, the above is NOT a response to "it may be your code" but
a (sarcastic) response to "it must be your code".

Thorsten, your comments are helpful, to the point and
no more judgemental than they absolutely have to be to
address the issue.  They offer real substance.  And provide
useful examples and suggestions.  

The post that the above was written in response to,
 in contrast to your helpful post, was
sarcastically judgmental
contained ZERO new information
contained ZERO helpful suggestions
TROLLish in tone and
wasteful of bandwidth by unnecessarily quoting

I have found most of the responses since then to 
be helpful, even when disagreeing.  They offer useful
information and suggestions.  Further, while suggesting,
oftimes strongly, that the code should be checked before
finger pointing at the compiler, most of the
subsequent posts seem to at least allow that perhaps,
when all else has been checked, the compiler may
have a bug.  WHICH WAS ALL I EVER MEANT TO 
SAY!
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00       ` Ian Chivers
@ 1998-06-05  4:00         ` Kevin G. Rhoads
  0 siblings, 0 replies; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-05  4:00 UTC (permalink / raw)



Dear Ian -
Yes.  

But our friend Jeffrey did not advance any reasoning
in his first response, he basically posted a "you ass"
message without any substance contained therein.

As I clarified in another post --
code that compiles cleanly -- without warnings
(including no warnings for uninitialized variables)
on 6 of 6 compilers --
which produces proper output after compile by 5 of 6
compilers not matter what settings are used
and produces garbage after compile by one
compiler but only when high optimization is chosen
is, to my taste, fairly STRONG evidence of an
optimizer bug.

Is it "proof"?  NO.

Add to this that the code has BEEN carefully checked.
Not once. But several times.

Is it "proof" of a compiler bug?  NO.

But there comes a point where you stop testing
the code and start checking the compiler.

According to Jeffrey's post, there NEVER comes 
such a time.
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
  1998-06-05  4:00       ` Thorsten Ohl
@ 1998-06-05  4:00       ` William Clodius
  1998-06-05  4:00       ` Ian Pattie
  1998-06-05  4:00       ` Ian Chivers
  3 siblings, 0 replies; 39+ messages in thread
From: William Clodius @ 1998-06-05  4:00 UTC (permalink / raw)



Dear Kevin:

All of what you've said boils down to
>the optimizer must be buggy<
asserted with 
NO justification, based on what was posted
NO reasoning or evidence offered in support

Would you care to offer some substantive
suggestions, data, or references?

I fail to see how anyone can reasonably
suggest that when code has only been tested
on one compiler, when only a small code exerpt has
been posted, when there are programming
errors that cannot be detected at compile time,
and the results of such errors are not defined
by the language that it MUST be bugs in the
compiler and that the code is necessarily faultless.

Are you just flaming?  Or do you have some
justification you are not sharing with the rest 
of us?

-- 

William B. Clodius		Phone: (505)-665-9370
Los Alamos Nat. Lab., NIS-2     FAX: (505)-667-3815
PO Box 1663, MS-C323    	Group office: (505)-667-5776
Los Alamos, NM 87545            Email: wclodius@lanl.gov



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00           ` John Appleyard
@ 1998-06-05  4:00             ` Keith Refson - real email address in signature
  0 siblings, 0 replies; 39+ messages in thread
From: Keith Refson - real email address in signature @ 1998-06-05  4:00 UTC (permalink / raw)



John Appleyard <News@polyhedron.com> writes:


> I totally agree about the dangers of uninitialised variables, array
> bound errors and the like, and particularly about the incorrectness of
> assuming that if it works with compiler A, but not with compiler B, then
> compiler B is bugged - but...

> ... this one looks like a compiler bug to me.  

I have to say I am beginning to come to that conclusion myself.
I have just verified that the code works and gives the expected
results for SGI and SunPRO compilers using either stack or static
allocation.  The DEC compiler with stack allocation is the only anomaly.


> I'd be happier if I knew
> the value if POSTMP(1) and POSION before the assignment to NGRPX,

The values in posion were the same on entry to this routine and exit
and have the values I gave.   But *whatever* values it has, POSTMP
should always be between 0.0 and 1.0 since it is assigned the value
MOD(x, 1.d0).

> I suppose NGRPX/Y/Z might be aliased,

No, they are local scalar variables and not in common.  So is POSTMP.

>  or the optimiser might have reordered code so that something
> with an aliasing implication was executed after the 1101 loop and before
> you inspected POSTMP, but that's a long shot.

Well the value recorded by the debugger for POSTMP(1) is rather
obviously the intermediate result of the computation of the 1st
argument of the MOD function for IM=3, the last iteration of
the 1101 loop.  One might expect this to be held in a register
and the array POSTMP optimizad away, but this value is clearly the one
used in computing NGRPX.

> I have found bugs just like this, even down to the WRITE making it go
> away. The act of printing forces the optimiser to regularise things,

It would presumably force a write to memory for the IO library calls
and a subsequent reload.  This would almost certainly fix any misallocation.

> What does the compiler vendor say?

Nothing yet as I haven't got an example anywhere near small enough to
usefully report.  I think I will though. The faulty value is produced
within a very short region of flow control where I can see no stack/vs
static errors, where no external subroutine is called which could
conceivably screw things up. The only other way a bug elsewhere could
affect this would be if it had clobbered a constant which was picked
up and used.  But this should affect POSTMP(1) and (2) as well.
Combined with the fact that stack allocation with optimization works
on Sun and SGI machines/compilers is useful (though not conclusive)
evidence that it's not a simple program bug.

Thanks for taking the trouble to study the details before posting!

Keith Refson

-- 
------------------------------------------------------------------------------
Email: Keith.Refson@  | Tel: +44 1865 272026 | Dr Keith Refson,              |
       earth.ox.ac.uk | Fax: +44 1865 272072 | Dept of Earth Sciences        |
                                             | Parks Road, Oxford OX1 3PR, UK|
------------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
  1998-06-05  4:00       ` Thorsten Ohl
  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       ` Ian Chivers
  3 siblings, 1 reply; 39+ messages in thread
From: Ian Pattie @ 1998-06-05  4:00 UTC (permalink / raw)



Well, I agree with Kevin.  Jeffrey must be dealing with some pretty
simple codes or something.

I can take 10 year old code, compile it with MS FPS (terrible, full
of bugs, especially when using automatic) and find optimization
bugs, in corrrect code.  Lahey LF90 too (they finally just disabled
their -o2 flag) and DVF.

In subroutines with 10 lines or 1000, it doesn't matter.  Five compilers
will work fine, the 6th will stumble.  Of course your code is the
first suspect, but in mature code that has worked fine for 10 years
or so, I usually end up finding an optimization bug.

Kevin G. Rhoads wrote:

> Dear Jeffrey:
>
> All of what you've said boils down to
> >you must be writing buggy code<
> asserted with
> NO justification, based on what was posted
> NO reasoning or evidence offered in support
>
> Would you care to offer some substantive
> suggestions, data, or references?
>
> I fail to see how anyone can reasonable
> suggest that when code
> compiles cleanly, with neither error NOR WARNING
> and produces two wildly different results
> depending ONLY on the compiler settings
> that it MUST be bugs in the code,
> and the compiler is necessarily faultless.
>
> Are you just flaming?  Or do you have some
> justification you are not sharing with the rest
> of us?
> --
> Kevin G. Rhoads, Ph.D.
> T_Rhoads@NO_SPAM.Classic.MSN.COM
> KRhoads@NO_SPAM.CmpNetMail.com






^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00       ` Kevin G. Rhoads
@ 1998-06-05  4:00         ` Stuart Brook
  0 siblings, 0 replies; 39+ messages in thread
From: Stuart Brook @ 1998-06-05  4:00 UTC (permalink / raw)



Kevin G. Rhoads wrote:
> 
> Please read what was written and respond to that.
> 
> Several thousand line PROGRAMS were mentioned,
> nowhere was it said that those were SINGLE SOURCE
> MODULE programs.
> 
> So put your prejudices aside, and reply only to WHAT
> WAS ACTUALLY WRITTEN, PLEASE!
----

Sheesh what a chip you seem to have on your shoulder ... 

I did respond to what was written ... with what amounts to the comment
that if these thousands of lines were a single compilation unit then
that's a miracle it compiled at all ... Nothing to do with prejudices.

It is not uncommon for people to generate humungous fortran compilation
units from some 4GLs.

Stuart



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00         ` Kevin G. Rhoads
@ 1998-06-05  4:00           ` Stuart Brook
  1998-06-05  4:00           ` Jeffrey J. Potoff
  1 sibling, 0 replies; 39+ messages in thread
From: Stuart Brook @ 1998-06-05  4:00 UTC (permalink / raw)



Kevin G. Rhoads wrote:
> 
> Exactly.
> 
> I have no disagreement with that.
> 
> However, when responding to flamers
> who assert that all errors MUST be
> in the code ALL the time.  Who so flame
> without adding any useful information.
> I responded by streamlining the logic.
> 
> It was probably a mistake to try to simplify
> the logic to the level where a self-righteous,
> unhelpful flamer (such as Jeffery would appear
> to be, based upon his post above) could
> perhaps understand it.  But I did
> so simplify the logic and present it.
> 
> So, yes, I agree.  The presence of errors
> which appear solely in response to increased
> optimization is NOT PROOF of a compiler
> bug.  It is merely evidence that may indicate
> several things.   And most of the things it
> can indicate are programmer errors or oversights.
> BUT, there comes a point, after one has tested
> the code, proof-read it repeatedly, asked fellow
> programmers to review it, tried multiple compilers
> with multiple settings and multiple debuggers and
> code testing tools -- somewhen, there comes a
> point at which checking for a bug in the optimizer
> is a reasonable thing to start doing.
> --
> Kevin G. Rhoads, Ph.D.
> T_Rhoads@NO_SPAM.Classic.MSN.COM
> KRhoads@NO_SPAM.CmpNetMail.com
----

You talk about flamers!  What gall ...

People here are trying to give you assistance which you consider
irrlelevent ... and throw flames at them.  Then you accuse THEM of
flaming ?  I suggest that you look in a mirror and see the fire in your
mouth!

Sheesh ... remind me never to offer assistance to you again ... glad
you're not one of the thousands of customers I've supported in 7 years
in customer support!

Stuart



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00         ` Kevin G. Rhoads
@ 1998-06-05  4:00           ` William Clodius
  0 siblings, 0 replies; 39+ messages in thread
From: William Clodius @ 1998-06-05  4:00 UTC (permalink / raw)



Kevin G. Rhoads wrote:
> <snip>
> The comment above was in response to the (implied) assertion that
> it MUST be a code bug.
> I never claimed it COULD NOT be a code bug,
> I stand by what I have posted before, in context --
> this kind of behavior indicates THE POSSIBILITY
> of a compiler bug
> and
> to assert that it ONLY results from code bugs is WRONG.
> <Snip>

Quoting in its entirety from another post by Kevin on this thread:

   Please read what I wrote and respond to that.

   If the code gives CORRECT answers with compiler
   optimizations OFF and it gives WRONG answers
   with compiler optimizations ON -- question, where 
   is the bug?

   Answer, in the compiler optimizations -- the code
   did NOT change, the compiler did.

You may not have intended to say this, but in this you have asserted
"it COULD NOT be a code bug".

Note the post by Jeffrey J. Potoff that seems to have incited your
deluge of postings, at first explicitly notes that optimizer errors are
possible, but you seem to not have taken well his comments to the effect
that one should not code around optimizer errors (which to me meant turn
of  the optimizer for that procedure rather than rewrite the code), and
a comment about the sloppiness of the person who wrote bad code which I
took to be refering to the more common case of programmer but not
optimizer errors, but you seemed to take to imply the non-existence of
optimizer errors.

-- 

William B. Clodius		Phone: (505)-665-9370
Los Alamos Nat. Lab., NIS-2     FAX: (505)-667-3815
PO Box 1663, MS-C323    	Group office: (505)-667-5776
Los Alamos, NM 87545            Email: wclodius@lanl.gov



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-05  4:00         ` Jeffrey J. Potoff
  1998-06-05  4:00           ` Kevin G. Rhoads
@ 1998-06-06  4:00           ` Rob Komar
  1 sibling, 0 replies; 39+ messages in thread
From: Rob Komar @ 1998-06-06  4:00 UTC (permalink / raw)



Jeffrey J. Potoff (jpotoff@rhea.umd.edu) wrote:
: 
: I write code in Fortran 90 for the Monte Carlo simulation of a 
: variety of fluids.  Most of my work is in the critical behavior
: of mixtures.  The codes are not terribly complex (at least not to
: me), but can be quite long.  They all compile with whatever
: optimization I choose and give me the exact same answers regardless
: of optimization level.  All the codes I have written have always 
: done that.  If they didn't, I knew there was a bug (almost always 
: in memory allocation) in the code.

Hi,
if you run your code on x86 machines and always get the same
answer regardless of optimization level, then I'd like to hear
from you on how you accomplish that.  I work on particle physics
Monte Carlo simulations on x86 machines, and have a devil of a
time getting the results to be the same at different levels of
optimization.  The transcendental functions built into the
387 FPU always return the result in double extended precision,
and I find that I can get different results depending on whether
the compiler stores the result in a memory location first,
or uses it directly in a calculation.  Which it chooses to do
can depend on the level of optimization.  If you know how to get
around this, please E-mail me at the address below.

Cheers,
Robert Komar            Physics Dept., Univ. of British Columbia, Canada
                        (stationed at the Sudbury Neutrino Observatory)
My mail address can be got from the following Unix command:
echo 'robkviaphysicsZubcZca' | tr 'Z' '.' | sed 's/via/@/'



^ permalink raw reply	[flat|nested] 39+ messages in thread

* SUMMARY: Code errors which can masquerade as compiler bugs  Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00 Mysterious data corruption in Fortran with -automatic Keith Refson - real email address in signature
  1998-06-04  4:00 ` Kevin G. Rhoads
  1998-06-04  4:00 ` Thorsten Ohl
@ 1998-06-06  4:00 ` Kevin G. Rhoads
  1998-06-11  4:00   ` Ron Sverdlove x2517
  1998-06-08  4:00 ` Steve Lionel
  3 siblings, 1 reply; 39+ messages in thread
From: Kevin G. Rhoads @ 1998-06-06  4:00 UTC (permalink / raw)



Summary:

Compiler bugs are real, but should be one of the
*last*
things to check.

Most language specific comments were directed to Fortran and C.


Programmer errors which

a) manifest or disappear depending upon compiler, settings, machine, data
b) can be misinterpreted as compiler bugs

include:

1) Uninitialized variables
2) Aliasing - can occur in any language by passing the same 
variable by reference to two or more parameters in the 
argument list of a function or subroutine -- in addition to 
the more commonly noted pointer aliasing -- in Fortran, 
we can add passing a variable by reference to a parameter 
when it is accessed by COMMON block as well
3) assumptions about persistence/lifetime -- particularly local variables: 
are they static or automatic -- in Fortran use SAVE as needed
4) assumptions about precedence and execution order in 
expressions -- in Fortran use parentheses (in C add also the 
comma operator) -- and C programmers working in other 
languages particularly beware that other languages DO 
NOT guarantee short-circuit evaluation nor strict 
left-to-right evaluation of Boolean/Logical expressions as does
the C standard
5) assumptions about memory layout (e.g., byte order), 
machine level format of types (e.g., ones-complement, 
twos-complement or sign-magnitude) and packing -- 
these assumptions also make code non-portable and are 
not limited to memory, Fortran unformatted files are 
another place to check for this
6) incorrect subroutine/function calls
   i) mismatched arguments - wrong size or type 
      (e.g., passing a 4 byte integer to a parameter expecting 
       a two byte integer will work on Intel boxes and blow up
       on any big-endian machine)
   ii) incorrect number of arguments (C, many other languages 
       will crash obviously)
7) array bounds overruns
8) string length overruns
9) insufficient stack

---------------------------------------
SPECULATION:
I also note that the respondents *seemed* to divide into two camps:
one group felt compiler bugs were real, but quite rare
another group seemed to feel compiler bugs were not uncommon

Perhaps this reflects platforms: workstation vs. wintel
Perhaps this is just randomness, a reflection of the small number of total
respondents.

Investigating this seems destined to create more flame than
aught else.
If someone with an asbestos beany-copter wishes to ask 
this question, go right ahead.

I am not touching it.
-- 
Kevin G. Rhoads, Ph.D.
T_Rhoads@NO_SPAM.Classic.MSN.COM
KRhoads@NO_SPAM.CmpNetMail.com



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00 Mysterious data corruption in Fortran with -automatic Keith Refson - real email address in signature
                   ` (2 preceding siblings ...)
  1998-06-06  4:00 ` SUMMARY: Code errors which can masquerade as compiler bugs " Kevin G. Rhoads
@ 1998-06-08  4:00 ` Steve Lionel
  3 siblings, 0 replies; 39+ messages in thread
From: Steve Lionel @ 1998-06-08  4:00 UTC (permalink / raw)




In article <wxsollf8zz.fsf@earth.ox.ac.uk>, rubber@bounce.com 
(Keith Refson - real email address in signature) writes:
|>I have just wasted about 3 days attempting to debug a really
|>mysterious problem with a FORTRAN program on DU 4.0D.  The original
|>problem is that the program gives different results when compiled with
|>the "-automatic" flag to put variables on the stack.

I can't add much to the extensive discussion that has gone on here already.
Yes, many times coding errors do reveal themselves at higher optimization
levels.  Yes, compiler bugs do exist.  Which is the case here?  Insufficient
data. 

You don't say what compiler version you're using (or even which compiler).
The current version of DIGITAL Fortran is V5.1.  If you have V4.1, there is
a downloadable update at www.digital.com/fortran/downloads.html that you
should try.

Should you manage to come up with a reasonable test case, please do send it
to us at fortran@digital.com - we'll be glad to take a look. 
-- 
Steve Lionel                      mailto:Steve.Lionel@digital.com
Fortran Development               http://www.digital.com/info/slionel.html
Digital Equipment Corporation     
110 Spit Brook Road, ZKO2-3/N30    
Nashua, NH 03062-2698             "Free advice is worth every cent"

For information on DIGITAL Fortran, see http://www.digital.com/fortran



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: Mysterious data corruption in Fortran with -automatic
  1998-06-04  4:00     ` Kevin G. Rhoads
                         ` (3 preceding siblings ...)
  1998-06-05  4:00       ` Harald Anlauf
@ 1998-06-08  4:00       ` Paul Winalski
  4 siblings, 0 replies; 39+ messages in thread
From: Paul Winalski @ 1998-06-08  4:00 UTC (permalink / raw)
  To: Kevin G. Rhoads


Kevin G. Rhoads wrote:
> 
> Please read what I wrote and respond to that.
> 
> If the code gives CORRECT answers with compiler
> optimizations OFF and it gives WRONG answers
> with compiler optimizations ON -- question, where
> is the bug?
> 
> Answer, in the compiler optimizations -- the code
> did NOT change, the compiler did.

When a program works with optimization turned off
but not when optimization is turned on, it usually
means one of two things:

1) The program is an illegal program that is doing
   something that the language definition says is
   illegal or has undefined or unpredictible results.

2) The program is triggering a compiler bug.

It's been my experience that the majority of
"optimizer bugs" turn out to be illegal programs.
It's quite easy to introduce these sorts of problems
into your code.  Just one small Fortran example:

    IF (A .NE. B) .AND. (FUNC(X, Y) .NE. 4)

where FUNC is a function that, as a side effect,
modifies variable Y, followed later by some code
that depends on FUNC having changed Y's value as
a result of the execution of the IF statement.
The Fortran language does not guarantee the order
of evaluation of expressions of equal precedence;
the compiler is free to evaluate the comparison of
A and B first and then shortcut the expression if
they're equal, so that FUNC never gets called.

When optimization is turned off, a simple-minded
full evaluation of the expression might take place,
so that the code seems to "work", but it "breaks"
if you turn on optimization and the compiler decides
to exercise its right not to call FUNC if it can
evaluate the expression without doing so.

This is a case where the code didn't change, but it
is not an optimizer bug.  The program is depending
on a particular result from an operation that is
defined in the language as being unpredictible.

--PSW



^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: SUMMARY: Code errors which can masquerade as compiler bugs  Re: Mysterious data corruption in Fortran with -automatic
  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
  0 siblings, 0 replies; 39+ messages in thread
From: Ron Sverdlove x2517 @ 1998-06-11  4:00 UTC (permalink / raw)



In article <01bd91bc$ac64ac80$LocalHost@stupidwin95>, "Kevin G. Rhoads" <T_Rhoads@NoSpam.CLASSIC.MSN.COM> writes:
>Summary:
>
>Compiler bugs are real, but should be one of the
>*last*
>things to check.
>

The best evidence that compiler bugs exist is when you submit a report to a
vendor with an example of your problem and they confirm that it is indeed a
compiler error.  In some cases they have a patch ready to send.  In others,
they say it will be fixed in the next version.  I use one Fortran 77
compiler and two Fortran 90 compilers from different vendors.  I have found
only a few bugs in the 77 compiler (not surprising since it has been around
for a long time), but I regularly find bugs in both of the 90 comiplers.
Again, I know that these are compiler bugs because the vendors have agreed
that they are.

Nevertheless, I agree with the statement that one should check every other
possibility carefully first because user errors are certainly much more
common that compiler errors.

-- 
Ronald Sverdlove               Computing Systems Research
rs@sarnoff.com                 Sarnoff Corporation
Tel. 609-734-2517              CN 5300
FAX  609-734-2662              Princeton, NJ 08543-5300





^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~1998-06-11  4:00 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-06-04  4:00 Mysterious data corruption in Fortran with -automatic Keith Refson - real email address in signature
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       ` 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-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           ` John Appleyard
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       ` 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
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 ` Thorsten Ohl
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

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