This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14179] [3.3/3.4/4.0 Regression] out of memory
- From: "mark at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Sep 2004 01:37:02 -0000
- Subject: [Bug c++/14179] [3.3/3.4/4.0 Regression] out of memory
- References: <20040217171044.14179.debora.j.estey@lmco.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From mark at codesourcery dot com 2004-09-23 01:37 -------
Subject: Re: [3.3/3.4/4.0 Regression] out of memory
giovannibajo at libero dot it wrote:
>>The most common case is probably that the "from"
>>and "to" types are the same. So, you could try having
>>implicit_conversion do "if same_type_p (to, from) && !class_type return
>>identity conversion". (Might even be better just to check pointer
>>equality of "to" and "from", so as to avoid the cost of same_type_p if
>>they are *not* the same.) That would short-circuit a lot of the work,
>>and might win for other test cases as well, because you save not only on
>>digest_init, but with function calls like:
>> void f(int);
>> void g() { f(3); }
>>
>>
>
>Yes, but the problem is that also default promotions are very common:
>
>void f(char);
>void g() { f(3); }
>
>and this is what we need to short-circuit for the testcase to start saving
>memory. I tried something like:
>
> if (INTEGRAL_TYPE_P (to) && INTEGRAL_TYPE_P (from)
> && same_type_p (type_promotes_to (to), type_promotes_to (from)))
> return ocp_convert (to, expr, CONV_IMPLICIT, flags);
>
>but I'm not sure about those type_promotes_to, plus it segfaults for some
>reason I'm investigating...
>
>
I don't know about the segfault, but I'd worry that you might not win
much once the tests get that complex, at least for code other than this
one test case. Giant arrays with huge initializers are not the typical
case, thankfully.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14179