[Info-vax] Whither VMS?

jls notvalid at yahoo.com
Wed Oct 7 16:53:21 EDT 2009


On 5 Oct 2009 09:25:25 -0500, koehler at eisner.nospam.encompasserve.org
(Bob Koehler) wrote:

>In article <ha6oek$gn9$02$1 at news.t-online.com>, Michael Kraemer <M.Kraemer at gsi.de> writes:
>> 
>> That's not a problem of null termination,
>> it's a problem of writing to an area you do not own.
>
>   It's a problem of the called routine having no way of preventing you
>   from writing to an area you do not own.  Other languages do actually
>   prevent it.
>
>> This may happen in any language, i.e.
>> Assuming a fixed size of your data objects
>> because it would never ever been exceeded
>> (Y2K comes to mind).
>> In C, one would have used sth like
>> aBuffer = calloc( strlen(someString)+1, sizeof(*aBuffer) )
>
>   In Fortran, one would pass a string (CHARACTER), and the language 
>   definition requires that the called function has access to the
>   allocated length of the buffer, although this is implemented
>   different ways by different compilers, and the function can prevent 
>   the buffer from being overwritten.
>

This may be neither here nor there, but I recall supporting a program
written in FORTRAN/Fortran on VMS (VAX and Alpha) which started
completely misbehaving/crashing/acting strange all around.

After much investigation, and lots of treks through run/debug, I
finally tracked things down to a variable at the top-most level of the
program being modified from inside a subroutine to which it was never
passed.

It turned out that during a recompile/relink, the variables were
mapped diffferently and a string/character variable that was receiving
more data than allowed by it's declaration statement was now
overwriting this other variable due to the overflow (the variables
were now being mapped into sequential places in memory).

How it worked before the memory mapping was rearranged must have been
a complete "happy accident".  The bug was in that code from day 1 but
had somehow never surfaced before it was recompiled to take advantage
of improvements in a new version of the Fortran compiler.



More information about the Info-vax mailing list