This is the mail archive of the
mailing list for the GCC project.
invoking gcc multiple times in the same process
- To: gcc at gcc dot gnu dot org
- Subject: invoking gcc multiple times in the same process
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Wed, 9 May 2001 00:02:23 +1000
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 <firstname.lastname@example.org> | "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.