Adriaan van Os wrote:
BTW, was it a soft or hard limit? GPC contains code that should eliminate the former, but of course, it's helpless against the latter. Anyway, a certain amount of stack usage for large programs probably just has to be accepted (note that the respective tests are actually quite large programs, despite their apparent file sizes, due to heavy use of macros etc.).
It's a soft limit, that defaults to 512 KB. The hard limit defaults to 64 MB.
Oh, I just see, they seem to have removed the code (gcc-2.95.2/gcc/toplev.c:4783) in gcc-3. I could add the code to GPC now, but I guess there was some reason why they removed it (but the ChangeLog doesn't tell anything). Does anybody know anything about it?
It's remarkable that the crashes are reported as EXC_BAD_ACCESS (0x0001) code KERN_INVALID_ADDRESS, not as stack overflow. I could do some debugging with GDB to see whatÂs happening. Actually, debugging GPC programs with GDB on Mac OS X seems to work.
Systems vary in how they handle stack overflows. Under Linux I just get a segfault. I don't know which error codes Mac OS X has available, and if that's the expected one here ...
You're right. The test was meant to check the behaviour of some routine in an out-of-memory situation, but the way to reproduce this situation was poor.
The new systemtest.pas give me this:
[G4:~/gnu/testgpc/test] adriaan% make MASK="systemtest.pas"
TEST systemtest.pas: *** malloc: vm_allocate(size=2147483648) failed with 3 *** malloc[1412]: error: Can't allocate region *** malloc: vm_allocate(size=2147483648) failed with 3 *** malloc[1412]: error: Can't allocate region OK
I think that's a bug in malloc which should return NULL if no more memory is available, don't you agree?
A simple C test case is the following (which should run forever, and I suppose will abort on your platform):
#include <stdlib.h>
int main () { while (1) malloc (0x70000000); return 0; }
I could check for that issue and let the test be "SKIPPED" then. But first you might want to contact the C people or Apple to find out if they intend to fix the bug ...
Frank