From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,cf4ba3d07912d446 X-Google-Attributes: gid1164f8,public X-Google-Thread: 1094ba,cf4ba3d07912d446 X-Google-Attributes: gid1094ba,public From: Robert O'Dowd Subject: Re: Mysterious data corruption in Fortran with -automatic Date: 1998/06/05 Message-ID: <3577C554.9F50B096@nonexistant.com>#1/1 X-Deja-AN: 359781328 Content-Transfer-Encoding: 7bit References: <01bd9013$76f09aa0$6f242499@stupidwin95> <35774C1A.2985A59E@rhea.umd.edu> <01bd9036$7ae7fea0$LocalHost@stupidwin95> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Defence Science & Technology Organisation Newsgroups: comp.sys.dec,comp.lang.fortran 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. - 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