[comp.lang.ada] Response to Ada vol 88 issue 235 bug in Ada compiler

AMXMC-SEL@WSMR-SIMTEL20.ARMY.MIL (Mark Oestmann) (11/17/88)

>The following program on a VAX 8700 prints out:
>"Hello, your program is exceptional!"
...
>Two questions: 1. Am I overlooking something very basic?  Or, 
>2.  Is the compiler here broken? Is _yours_?
>
>with text_io; use text_io;
>procedure bug is
>   m:array (0..32767,0..32767) of character;

	Yes there is something significant here, The VAX/VMS does not allow
over 1 gigabyte of storage on the stack.  The Ada compiler, partly due to this
and partly due to the 32 bit word structure, ignores all multiples of 1 
gigabyte on a variable.  M requires exactly 1 gigabyte storage, and so is 
alocated 0 bytes storage.
	To see the error, remove all exception handlers.  Line 6 tries to
modify a location at 32775 bytes above the base address of M.  This address is
allocated to system call code.  You are not allowed to write to these
addresses.  Note the error messages are system errors not ada exceptions.
	When you increased the range to 32768 it increased the required space
to 1 gigabyte + 32k byte and alocated 32k byte.  As you never accessed a
location above 32k byte + 8 (some system stuff such as vectors and text for the
exception handlers are up on the stack too) there was no exception.
	Try changing the upper limit of the ranges to 32766 and compiling for a
compiler error message! 
	For practical reasons, the size of the array should not be more than a
few megabytes unless the system you are useing is very lightly used and has 
a lot of unused disk space for page files.  Otherwise you will be hoging much
more than your share of the system resources!  Using 1 gigabyte of page memory
on most systems is not allowed (even if physicaly possible)!

				Gary V. Dunlap
				School of Engineering and Logistics
				Red River Army Depot
				Texarkana, TX 75507-5000
				214/334-2522

				AMXMC-SEL@SIMTEL20.ARMY.MIL

-------