[Bug c++/14179] [3.3/3.4/4.0 Regression] out of memory
mark at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 23 01:37:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list