Subject: Re: serious bug with CYGNUS GCC b16
From: [email-masked] (Jim Balter)

3 Dec 1996 20:35:18 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0Gold (WinNT; I)
Original-To: [email-masked]
Original-CC: [email-masked]
Original-Sender: [email-masked]

[email-masked] wrote:
> 
> Hi Pascal, you wrote:
> 
> : #define ARRAY_SIZE 2038010
> :
> : int
> : main (void)
> : {
> :   char A [ARRAY_SIZE];
> : }
> 
> : (bug.exe 1000) exception is: STATUS_STACK_OVERFLOW
> 
> The problem is not b16, but that automatic arrays are allocated on the stack.

This is in a sense a bug in the ANSI/ISO C spec, which says nothing
about a limit on the size of auto objects other than the limit on
objects in general (which is an implementation-defined matter).
Nor is it able to, since a) the limit depends upon the current stack
depth and b) the stack model isn't explicit in the spec.

But just because the spec doesn't give a limit, that doesn't mean there
isn't one!  Just what result is M. Obry expecting?  It can't be a
compile-time error, because the limit varies according to available
memory and stack depth.  It can't be a null return from malloc,
since malloc wasn't called.  If the complaint is simply that,
in addition to the stack overflow exception, memory gets overwritten,
that is a consequence of no access protection for that memory,
and for the fact that no one wants to pay for the cost of checking
the current stack depth on every allocation of local variables.
If you don't like memory corruption, you might try another OS.

"Dr., it hurts when I do this."  "Then don't do that."

--
<J Q B>
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".