Thread View: gnu.gcc.bug
2 messages
2 total messages
Started by Matthew Self
Sat, 08 Oct 1988 06:19
dynamic arrays with insufficient space cause core dump
Author: Matthew Self
Date: Sat, 08 Oct 1988 06:19
Date: Sat, 08 Oct 1988 06:19
22 lines
1558 bytes
1558 bytes
After converting my latest program to use dynamic arrays, I tried running it on some very large data sets to see how it would break. Unfortunately, it appears that if there is insufficient space to allocate a dynamic array, the program just dumps core with no explanation. My previous code which did all of the dynamic allocation through malloc would explain that malloc refused the program the space it wanted, and would even mention which array couldn't be allocated. It would be nice if programs compiled with gcc using dynamic arrays did something along these lines. An even more difficult problem arises if the program can work around the lack of space problem and wishes to continue execution some other way. Perhaps in this case the program just shouldn't use dynamic arrays and should call an allocation routine explicitly. The only other solutions would seem to require adding new extensions to c, which should probably be avoided. I haven't yet looked at the source to see how any of this might be done. A penny for your thoughts.... Matthew Self NASA Ames Research Center self@bayes.arc.nasa.gov
dynamic arrays with insufficient space cause core dump
Author: Richard Stallman
Date: Sat, 08 Oct 1988 06:36
Date: Sat, 08 Oct 1988 06:36
11 lines
1041 bytes
1041 bytes
This problem is not limited to dynamic arrays or to GNU C. The same bad error message can result from allocating a fixed-size array, in any C compiler. You can make your program work by using the command `unlimit stack' first. As for the general problem, I agree the current situation is not a desirable one, but I don't see a solution in the compiler. In the GNU system I think I can see how to arrange for better error reporting for stack overflow, which would distinguish it from stray references. But this requires the compiler and library to cooperate.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads