https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127752
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|ipa |middle-end
Last reconfirmed| |2026-10-08
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think this is ultimatively a C frontend issue, we shouldn't have to walk
fields but the frontend should set DECL_PRESERVED_P if the language requires
this.
Would we need to preserve the decl if only c.b was read? Why would we not
need to preserve c when it is not accessed at all?
That said, the middle-end cares about volatile VAR_DECLs, but non-volatile
VAR_DECLs with just volatile fields are a very grey area.
But yes, the volatile load e = c.b should not have been elimiated by RTL
expansion, so confirmed.
OTOH an effectively 'const volatile' object is a weird thing. But there
we get into the C frontend territory and the odd concept of a partially
volatile object.