| This is a user programming error. MODE calls ITOSTR passing IARR, an
undeclared variable which is implicitly an integer scalar, but ITOSTR
treats the argument as a 10-element array. It overwrites storage which
happens to be the argument list for a later call, causing the ACCVIO.
Steve
|
| Since I'm feeling generous today, I'll add a bit of instructional
material.
First, how I found the problem.. The OpenVMS debugger made this really
easy. I compiled, linked and ran /DEBUG, and when the ACCVIO occurred,
I looked at what the program was doing. It was at the first
instruction of a routine, fetching its single argument - which had an
address of -1. Looking at the memory pointed to by AP, I saw that the
argument list had been overwritten with -1s. Not good. I did a
SET SCOPE 1, E/I @PC to see the CALLG instruction in the caller to see
who had called the routine. That gave me the address in static
storage where the compiler built its argument list. I reran the
program, set a breakpoint in the calling routine, and when it got
there, set a watchpoint on the argument list, then typed GO. Soon
enough, I found the data being overwritten. It was then a case of
following the argument chain, checking declarations (or lack thereof)
until I found the culprit. SHOW SYMBOL/TYPE was useful here too.
Second... when a program changes behavior between /OPTIMIZE and
/NOOPTIMIZE, it is more likely than not (indeed, a 90% or better
chance) that it's due to a user programming error and not a compiler
bug. The most common causes are array bounds being exceeded or
argument mismatches. In this particular case, /CHECK=BOUNDS would not
have helped, as the array was an argument and not adjustable (indeed,
it was assumed-size). But IMPLICIT NONE would have caught the problem.
I'd like to suggest that, at a minimum, customers be asked to compile
their programs with /CHECK=BOUNDS/WARN=DECLARATIONS and be able to
compile with no errors before being submitted to us for possible
compiler bugs.
Steve
|