This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, libiberty]: Add a couple of missing casts
- From: Ian Lance Taylor <iant at google dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, Ian Lance Taylor <iant at google dot com>, Uros Bizjak <ubizjak at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Teresa Johnson <tejohnson at google dot com>
- Date: Wed, 13 Nov 2013 07:50:47 -0800
- Subject: Re: [PATCH, libiberty]: Add a couple of missing casts
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4a7ktYNf5D8qEAoScrFDidV520piF_YWd0Czf=YXUZrfg at mail dot gmail dot com> <CAKOQZ8zNO+j6ik13SMg4ZNXhJHYRx1UJujzrei-_NkK7L7HyQQ at mail dot gmail dot com> <CAFiYyc3LuqZBWRzN7Cw-pep9PRgp0rQC3oPqPJ2P_zJUW0RuSQ at mail dot gmail dot com> <20131113153058 dot GA9012 at blade dot nx>
On Wed, Nov 13, 2013 at 7:30 AM, Gary Benson <gbenson@redhat.com> wrote:
> Richard Biener wrote:
>> On Tue, Nov 12, 2013 at 8:55 PM, Ian Lance Taylor <iant@google.com> wrote:
>> > On Tue, Nov 12, 2013 at 11:24 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> > >
>> > > This was uncovered by x86 lto-profiledbootstrap. The patch allows
>> > > lto-profiledbootstrap to proceed further.
>> > >
>> > > 2013-11-12 Uros Bizjak <ubizjak@gmail.com>
>> > >
>> > > * cp-demangle.c (d_copy_templates): Cast result of malloc
>> > > to (struct d_print_template *).
>> > > (d_print_comp): Cast result of realloc to (struct d_saved scope *).
>> > >
>> > > Tested on x86_64-pc-linux-gnu.
>> > >
>> > > OK for mainline?
>> >
>> > The patch is OK, but this code is troubling. I obviously should
>> > have looked at it earlier. The C++ demangler is sometimes used in
>> > panic situations, when malloc is not available. The interface was
>> > designed to be usable without requiring malloc, by passing in a
>> > sufficiently large buffer. I'm concerned that we apparently now
>> > require malloc to work.
>>
>> That indeed looks like an important regression - Gary, can you
>> please work to fix this?
>
> I'm on it.
Thanks. See also the cplus_demangle_print_callback function.
Ian