This is the mail archive of the
mailing list for the GCC project.
Re: help with PR69133
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>, Jan Hubicka <hubicka at ucw dot cz>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Kugan Vivekanandarajah <kugan dot vivekanandarajah at linaro dot org>
- Date: Mon, 18 Jan 2016 15:06:33 +0100
- Subject: Re: help with PR69133
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjM=gA7=Z8H=koZhX0kuxi+aAVp1ZLik=50cYZkv_GzJzdQ at mail dot gmail dot com> <CAAgBjMnJJSdZKLVxrsM6_bXkdq50kobZbBf+dzErCDiuJdbvuA at mail dot gmail dot com> <CAFiYyc0=N3KRntpeMi4ar-n5PjP09bxDExY=T2YJJY2jtDt2AQ at mail dot gmail dot com>
> On Mon, Jan 18, 2016 at 10:28 AM, Prathamesh Kulkarni
> <email@example.com> wrote:
> > On 17 January 2016 at 14:56, Prathamesh Kulkarni
> > <firstname.lastname@example.org> wrote:
> >> Hi,
> >> I was having a look at PR69133.
> >> It appears that with -flto-partition=none,
> >> cgraph_node::get_untransformed_body ()
> >> is called twice for node with asm_name _ZThn4_N11xercesc_3_11C5m_fn6ERKi.
> >> c++filt says it is: non-virtual thunk to xercesc_3_1::C::m_fn6(int const&)
> >> get_untransformed_body() calls
> >> lto_free_function_in_decl_state_for_node() which sets
> >> node->lto_file_data to NULL.
> >> Now 2nd time get_untransformed_body is called for the same node,
> >> node->lto_file_data is NULL and lto_get_decl_name_mapping() dereferences
> >> lto_file_data which results in segfault.
> >> I was wondering if gating on lto_file_data could be a reasonable solution ?
> >> if (!lto_file_data)
> >> return false;
> >> I am not sure what value to return for this case (I chose false
> >> because of early exit).
> >> It prevents the ICE, and the patch passes bootstrap+test on
> >> x86_64-unknown-linux-gnu.
> >> With partitoning enabled, for the above test-case,
> >> get_untransformed_body () is called only once per node. However I
> >> don't understand why it gets called twice with -flto-partition=none.
> > Kugan pointed out to me the test-case doesn't ICE by passing -fno-ipa-icf.
> It looks to me we are not supposed to call this twice on the same node
> but nothing guards against that (and we don't release the untransformed
> body either). -flto-partition=none is special here becaue it combines WPA
You are suppose to read every function body just once from LTO stream. Doing
it multiple times is a waste. You can call get_body and get_untransformed_body
as many times as you want as tHere is guard:
const char *data, *name;
tree decl = this->decl;
if (DECL_RESULT (decl))
once you read the body DECL_RESULT is set. Only way you can get past this
to ICE should be the case where you read the body and then trhow it away.
> and late stage. IPA ICF is the only IPA pass needing untransformed bodies
> during WPA.
That is not exactly true. We also read untransformed bodies when merging
I will check the PR. ipa-icf is not supposed to get body of thunks.