This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Avoid segfault if line_table->maps is not set up
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: tromey at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 01 Mar 2010 23:18:33 +0100
- Subject: Re: PATCH: Avoid segfault if line_table->maps is not set up
- References: <ydd8wairbd1.fsf@CeBiTec.Uni-Bielefeld.DE> <m3bpfbomfo.fsf@fleche.redhat.com>
Tom Tromey <tromey@redhat.com> writes:
>>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
> Rainer> In ggc-common.c (gt_pch_restore), host_hooks.gt_pch_use_address
> Rainer> returned with result < 0, and fatal_error ("had to relocate
> Rainer> PCH") is called before line_table->maps has been set up, so
> Rainer> set->maps is NULL in line-map.c (linemap_lookup). It seems very
> Rainer> bad to segfault here instead of just returning, so I fixed this
> Rainer> by returning a dummy line_map instead. Just returning NULL
> Rainer> didn't work since too many places seem to assume that this
> Rainer> cannot happen.
>
> Restoring the PCH is such a special case that I think it should assume
> responsibility for initializing the line map if it encounters a failure.
> What do you think of that as an alternative?
I'm fine with that, though that's for the pch maintainers to handle.
I'll probably just file a PR.
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University