This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

invoking gcc multiple times in the same process


For the Mercury front-end to GCC, I'm using the same driver
as in the existing Mercury compiler, rather than the gcc.c driver.
This driver invokes the GCC back-end in the same process, and wants to
do so multiple times.

Unfortunately, however, if you call GCC's toplev_main() twice in the same
process, then it breaks.  The symptom is that on the second invocation
GCC tries to consume way too much memory and eventually gets killed.
(This was using a snapshot from early this year).

I haven't investigated the cause, but obviously the code never expected
to be invoked twice, and isn't cleaning up after itself properly.

Any guesses as to roughly how much work it would be to fix that?

Currently I'm working around it, by only invoking toplev_main() at
most once.  But this is a bit inelegant (particularly because it is
inconsistent with the way the Mercury driver handles other back-ends.)
I'm wondering whether it is worth trying to fix the GCC back-end
so that it can handle being called multiple times.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]