https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71571
--- Comment #8 from Hans-Peter Nilsson <hp at gcc dot gnu.org> --- (In reply to David B. Robins from comment #7) > I have verified that the pr71571.C test case attached does expose the bug on > trunk and that it passes with the above fix. Great, thanks for the report and for your time. I think this will do. > (Note "-O2 -fno-inline" are > required to ensure a crash; see earlier comment; in 4.3.1 "-O2" sufficed, > either because it did not inline these thunks or used different criteria.) For future reference, above I mentioned putting it in gcc/testsuite/g++.dg/torture, not ../inherit, and there no "-O2 -fno-inline" combo would not have been required, as I believe the bug would be exposed in the -O0 iteration. Experience says it is brittle to assume "-O2 -fno-inline" would be all that's "stopping" optimizations.