From: jqb AT netcom DOT com (Jim Balter) Subject: Re: serious bug with CYGNUS GCC b16 3 Dec 1996 20:35:18 -0800 Sender: daemon AT cygnus DOT com Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <32A4D8BF.698B.cygnus.gnu-win32@netcom.com> References: <009AC4FC DOT C37EA2A0 DOT 5525 AT ifk20 DOT mach DOT uni-karlsruhe DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0Gold (WinNT; I) Original-To: dahms AT ifk20 DOT mach DOT uni-karlsruhe DOT de Original-CC: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com dahms AT ifk20 DOT mach DOT uni-karlsruhe DOT de 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." -- - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".