Subject: Re: bug#76559: 31.0.50; [-O3 + PGTK] Crash when 'copying as kill'/'killing word'

From: Pip Cet <[email-masked]>
Date: Sun, 02 Mar 2025 10:33:09 +0000

R"Po Lu" <[email-masked]> writes:

> Paul Eggert <[email-masked]> writes:
>
>> On 2025-03-01 21:10, Po Lu wrote:
>>>> I don't see why that assumption would cause GCC to generate the wrong
>>>> code here, as no single thread of execution would have two such
>>>> accesses.
>>> It doesn't take control flow into account, but rather _every statement
>>> operand_ in the current procedure that addresses an aggregate declared
>>> in the same procedure.
>>
>> In that case it's a GCC bug, right? Since GCC promises that one can do
>> union punning.
>
> Yes, that's what I was getting at.  I even proposed a fix.  But the GCC
> list has lately been infused with a series of threads proposing new
> obstacles to engaging with its developers (search "Sourceware
> infrastructure plans"), and I'm not interested...

Are you going to report the GCC bug?  If not, I'd like to do so, with
your permission.

As far as the problem itself is concerned, it's a minor oversight in the
SRA code which fails to account for holes when choosing a representative
union access out of a list of all places which access a given structure,
so the fix seems simple.

Working around the problem may be more difficult, and it might be
easiest to disable the SRA pass for bad GCC versions, but maybe
something will occur to the GCC folks.

Pip