Hi,

On Fri, May 27 2022, Richard Biener wrote:
> On Thu, May 26, 2022 at 4:47 PM Martin Jambor <mjam...@suse.cz> wrote:
>>
>> Hi,
>>
>> PR 105639 shows that code with type-mismatches can trigger an assert
>> after runnning into a branch that was inteded only for references to
>> variables - as opposed to references to functions.  Fixed by moving
>> the condition from the assert to the guarding if statement.
>>
>> Bootstrapped and tested on x86_64.  OK for trunk and then gcc 12?
>
> OK.  There's the same assert below - I guess that doesn't need the same
> treatment?

Thanks.  The assert below also allows the case when cst is an ADDR_EXPR of
a function.  And the whole reference-counting is initiated only for
these two cases.  So in all other cases the condition

  rdesc->refcount != IPA_UNDESCRIBED_USE

will be false.

Martin

>>
>>
>> gcc/ChangeLog:
>>
>> 2022-05-25  Martin Jambor  <mjam...@suse.cz>
>>
>>         PR ipa/105639
>>         * ipa-prop.cc (propagate_controlled_uses): Check type of the
>>         constant before adding a LOAD reference.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2022-05-25  Martin Jambor  <mjam...@suse.cz>
>>
>>         PR ipa/105639
>>         * gcc.dg/ipa/pr105639.c: New test.

Reply via email to