From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199610211809.OAA03037@churchy.gnu.ai.mit.edu> Date: Mon, 21 Oct 1996 14:09:00 -0400 From: Craig Burley Subject: Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question [Note that I'm on the axp-list, but not the linux-alpha list, at the moment.] >This is kind of a silly error to fall into, but I did- > >I was recompiling gcc-2.7.2.1 (with itself) and the rebuilt cc1 kept >on core dumping on enquire.c. > >After scratching my head and trying a couple of things and (sadly) >pestering Mr. R. Henderson, I finally realized that the problem >was simply that 8MB stack ain't nearly enough (after all, it used >to take 20+MB of stack to compiler mem_rop.c on a sparc, and that >isn't nearly so memory consumptive as an alpha...). > >Because this was set as a hard limit, you have to be root to increase >it, and now I'm happily moving along compiling away. Whoa. Maybe this is what I ran into a couple of days ago. Not only would the cc1 I was building core-dump doing _anything_ -- even being invoked with no arguments -- running gdb on it would core- dump gdb! The closest I got to finding the problem was getting into where init_lex() calls xmalloc(), and stepping into the call to malloc() would core-dump. But, so would breaking on an _earlier_ xmalloc() call and running from there! Here's what really threw me. I knew I had been happily building and using new cc1's for months, and that I'd made only one change that triggered building the new (buggy) cc1. That was adding more options to the lang_options[] table in toplev.c (via g77's gcc/f/lang-options.h file). I don't understand, offhand, how increasing the size of a global table (whose length seems not to be directly used by any code in toplev.c to set the size of something allocated on the stack) could trigger a stack overflow error. But, I do know that when I commented out the new options, the rebuilt cc1 worked fine -- as did the cc1 I got when I commented them back in, but commented out g77 options that were duplicates of gcc options anyway (and thus didn't really need to be in g77's list). So, reducing the size of this global table did indeed make the symptoms disappear. (Are these globals allocated on the stack, a la systems like the Mac OS??) I realize I don't, at this moment, know all of the issues, but I'd like to _strongly_ suggest that if we're at the point of sometimes exceeding the _default_ stack sizes everyone gets with Linux/AXP on something as vanilla/smallish as cc1, we need to do one of two things ASAP: - Find whatever bug or misdesign is resulting in too much stack being used for cc1 (after all, g77's much larger f771 runs fine on my system). This is unlikely to be cc1's fault per se, I mean maybe the compiler/assembler/ linker/loader used to build and run cc1 are doing something really wasteful. - Increase the default stack size for Linux/AXP so hardly anybody ever needs to change it. Claiming that neither of the above need to be done because people can simply change their stack size is, IMNSHO, ludicrous. Yes, they _can_, but how are they going to know they're supposed to do it, when all they see is a very obscure diagnostic that points to no documentation or explanation, and even the _debugger_ doesn't work (or explain why it isn't working)??? So, don't claim that...let's fix the problem, either by increasing the stack (assuming it's too small) or fixing the toolchain problems resulting in the stack being abused by things as ordinary as cc1. Yes, I'm volunteering, if I can do anything to help out (investigate, etc.). I'm running a really old Linux/AXP (part of why I didn't report the problem), and have plenty of g77 work to do, but fixing this is very important IMO. tq vm, (burley) -- To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null