https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115944
Sam James <sjames at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sjames at gcc dot gnu.org --- Comment #3 from Sam James <sjames at gcc dot gnu.org> --- I think the UB makes it hard here. I'll let someone else comment if the expectation is reasonable, but optimize("O0") on MyClass::call() makes it work. If you add a __builtin_abort() call underneath the dodgy assignment, it works fine. Is there a reason you can't use that instead? (Why are we relying on a segfault?)