delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/01/19:01:17

Message-ID: <34F9F6B5.26CF4931@geoplex.com>
Date: Sun, 01 Mar 1998 16:00:53 -0800
From: Bill Bouma <bouma AT geoplex DOT com>
MIME-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
CC: "'A. Sinan Unur'" <sinan DOT unur AT cornell DOT edu>, djgpp AT delorie DOT com
Subject: Re: gcc running out of memory?
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980301132645 DOT 13547N-100000 AT is>

Eli Zaretskii wrote:
> 
> On Sun, 1 Mar 1998, Bill Bouma wrote:
> 
> > > now, those were general recommendations. it sounds more like you are
> > > running out of stack space. once you make sure enough memory is
> > > available, you can use stubedit to increase the default stack size for
> > > gcc (just go to the bin directory, type stubedit gcc.exe, and set it
> > > to
> > > 1Mb or more, and give it a shot.)
> > >
> >       Thank you for your help.  Unfortunately I have tried both of your
> >       suggestions but I am still getting the "illegal instruction" error.  I
> >       set the stack size of gcc at 8MB.  According to stubedit, that value
> >       is a minimum, so the stack size probably should grow automatically
> >       as needed?
> 
> No, the stack is allocated at startup in its entirety, and doesn't grow
> as needed (that's why you were advised to enlarge it).


Ok, I figured it all out.  The stack size WAS the problem.  What
happened was that I had named the file with a ".cpp" extension.  I
guess this was causing it to use the c++ compiler.  When I did
"gcc -v" it showed that the crash was happening when running "cc1plus".
So I upped the stack size of "cc1plus" to 4MB and the compilation worked!

Now, here is the curious thing about this.  It was not that I had such
a large "switch" statement in the file.  I tested this by making a 
function with a switch with 1000 cases, gcc had no problem.  The problem
was actually caused by the huge number of MACROS being used in the file.
I made a file containing only MACRO calls and tried to compile it.  When
it got past about 150 calls, that is when this error started to occur.
However, running "cpp" on the file from the command line seemed to work.
So this brings up the question, is cc1plus doing its own preprocessing
of the file and not using cpp?  "gcc -v" doesn't show cpp being called.
How exactly does the preprocessing work?

Thank you for all your help!  You have made me very happy. 8^)

Bill <bouma AT geoplex DOT com>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019