Bug 000225

When Created: 06/15/1998 08:43:34
Against DJGPP version: 2.01
By whom:
Abstract: Stack probs in DJGPP
Mmmm, i'm not sure if it was *exactly* 2.01 release or 2.01 alpha or 2.02 alpha,
nor i'm not sure 'tis the real bug report, simply it doesn't work on PC gcc the
same thing those do with gcc under UNIX (AIX).
Following program, compiled with gcc crashes with violation message:

int main(void)
  double a[100000];

  printf("%e \n",a[999]);

when array of doubles (a) is placed outside of main() or dynamic allocation used
(malloc()) there's no problem. My thought it is poor stack management or some-
thing like that.

This seems VERY WEIRD to me, since DJGPP is 32-bit development system - the
array (a) should use only 800,000 bytes!
All variants of the program listed above works for me compiled with gcc under
AIX 4.2

Hoping 'twas not too laym, g00d luck!

Note added: 06/23/1998 16:59:54
By whom:
Another one who didn't read the FAQ :-(

You hit the fixed stack size limit of DJGPP (256 KB by default).
Effectively, this is a drawback of the 32bit programming interface
DPMI 0.9 we use: you can't have both an auto-increasing stack and an
auto-increasing heap there.

Fix: don't use large automatic data structures if you want to be
portable to many architectures. Use malloc() instead.

Closed on 04/13/1999 06:00:48: Programmer's error, not a bug.
By whom:

  webmaster     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010