From: John Appleyard <News@polyhedron.com>
Subject: Re: Mysterious data corruption in Fortran with -automatic
Date: 1998/06/05 [thread overview]
Message-ID: <3pq$jBA3B$d1QAJU@POLYHDRN.demon.co.uk> (raw)
In-Reply-To: 3577C554.9F50B096@nonexistant.com
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/ ************
next prev parent 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 ` Kevin G. Rhoads
1998-06-04 4:00 ` Jeffrey J. Potoff
1998-06-04 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 ` Ian Chivers
1998-06-05 4:00 ` Kevin G. Rhoads
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-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 ` Harald Anlauf
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 ` 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 ` Robert O'Dowd
1998-06-05 4:00 ` John Appleyard [this message]
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 ` Kevin G. Rhoads
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 ` 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
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