From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1094ba,cf4ba3d07912d446 X-Google-Attributes: gid1094ba,public X-Google-Thread: 1164f8,cf4ba3d07912d446 X-Google-Attributes: gid1164f8,public From: "Kevin G. Rhoads" Subject: Re: Mysterious data corruption in Fortran with -automatic Date: 1998/06/04 Message-ID: <01bd9013$76f09aa0$6f242499@stupidwin95>#1/1 X-Deja-AN: 359647622 References: Newsgroups: comp.sys.dec,comp.lang.fortran 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