https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102876
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 51731 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51731&action=edit gcc12-pr102876.patch Untested implementation of the optimization. So far a little bit limited, either it handles initialization of the whole var at once (usually scalar vars), or uses native_{encode,interpret}* infrastructure and in that case it can't handle unions or anything that needs relocations in the initializers. I guess in some cases it could be improved, but especially unions can be harder or very hard if the access path is not visible in the stores.