This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/2] Update iterator of next
On 2019/11/15 17:19, Jan Hubicka wrote:
>> On Fri, Nov 15, 2019 at 9:10 AM Jan Hubicka <hubicka@ucw.cz> wrote:
>>>
>>>> next is initialized only in the loop before, it is never updated
>>>> in it's own loop.
>>>>
>>>> gcc/ChangeLog
>>>>
>>>> 2019-11-15 Xiong Hu Luo <luoxhu@linux.ibm.com>
>>>>
>>>> * ipa-inline.c (inline_small_functions): Update iterator of next.
>>>
>>> OK,
>>> thanks!
>>
>> This breaks bootstrap and the loop before is similarly odd.
>>
>> (gdb) p edge
>> $1 = (cgraph_edge *) 0xa5a5a5a5a5a5a5a5
>>
>> so apparently edge->next_callee is GCed (thus 'edge' itself is freed?)
> Loop before seems OK, it has next variable because the edge it works
> with may be removed.
>
> Only the next loop seems to omit set of next.
>>>> + {
>>>> + if (edge->speculative
>>>> + && !speculation_useful_p (edge, edge->aux != NULL))
>>>> + {
>>>> + edge->resolve_speculation ();
>>>> + update = true;
>>>> + }
>>>> + next = edge->next_callee;
> The problem seems that next should be set before and not after resolvign
> (which indeed may remove edge).
>
> I will fix that.
Sorry to break the bootstrap. This was my lack of consideration when
splitting this small piece of code from the previous patch, the line
should be in the first line of the second loop. Could you please add
some comments that edge may be freed in resolve_speculation()? Thanks.
Xiong Hu
>
> Honza
>>>> + }
>>>> if (update)
>>>> {
>>>> struct cgraph_node *where = node->inlined_to
>>>> --
>>>> 2.21.0.777.g83232e3864
>>>>