g++ memory bug.

Theodore Papadopoulo Theodore.Papadopoulo@sophia.inria.fr
Fri Jan 8 05:45:00 GMT 1999


	I totally agree with you that the second solution is better 
provided some user control is provided. I will give it a try.

On the other hand, it seems to me that in this specific case the 
variables are not used and will be removed by the optimizer so that 
in theory the function could be completely inlined. I must admit that:

1) I have not verified with the standard that nothing prevents such 
optimizations (althought I don't see why this would be forbidden).

2) I do not understand the template instanciation code and its 
interaction with the backend enough to be sure that this is indeed possible
within the current framework.

3) The question whether this can indeed arise with useful code 
(with no other ways of doing it) and thus if it would be worth.

I checked what does KaiC++ and it looks like there is only one level 
of inlining which explains very well why the program compiles but 
execution times are increase exponentially with the level of 
recursive templates.

In this regard, egcs does much better since when it is able to do the 
full inlining as it suppresses all the calls....

So Mike's second patch is doing a good tradeoff between egcs inline 
capability and Kai's reliability. I believe that this is the best 
solution (at least for the time being).

I will try it after adding the -finline-limit=10000 suggestion.
This way I hope that we will be able to compile some heavily 
recursive templated code that we are currently unable to compile with 
egcs (blitz like code).

	In any case, thank's a lot for the answer and I hope to send 
some news about these tests soon.

--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------





More information about the Gcc-patches mailing list