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

From: Pip Cet <[email-masked]>
Date: Thu, 27 Feb 2025 12:04:22 +0000

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

> Po Lu <[email-masked]> writes:
>
>> In a word, tampering with optimizer options is tantamount to playing
>> with fire.  Don't do it, if your object is a functioning Emacs.
>
> Which, if it wasn't apparent, belies my earlier theory respecting what
> would be reported in C++ mode as ODR violations.  It's a genuine GCC
> bug.

I don't think your case proves that.  In your "reduction" code, you have
this:

void
kbd_buffer_store_buffered_event (union buffered_input_event *event,
				 struct input_event *hold_quit)
{
  *hold_quit = event->ie;
  *kbd_store_ptr = *event;
}

When event->ie is accessed, GCC can conclude that the 'ie' union member,
not the 'sie' union member, is active, and legitimately perform the
truncation which results in the incorrect code.

It is, of course, possible that there's still a GCC bug here.

Pip