https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66223
--- Comment #7 from Daniel Frey <d.frey at gmx dot de> --- (In reply to Jakub Jelinek from comment #6) > The advantage of __builtin_unreachable () is that it allows better > optimizations, at the expense of the invalid code not being so nicely > reported. > With -fsanitize=undefined you get the undefined behavior reported, but with > information loss - it is reported as a call to __builtin_unreachable rather > than call to pure virtual method. > Perhaps as a compromise we could make sure __cxa_pure_virtual is called in > this case when -fsanitize=undefined (say in particular with > -fsanitize=unreachable) and let it be optimized to __builtin_unreachable > otherwise? I checked the Itanium ABI and I guess https://mentorembedded.github.io/cxx-abi/abi.html#pure-virtual is sufficiently loosely specified to allow __builtin_unreachable (or basically anything you like). Anyways, calling __builtin_unreachable did call the terminate-handler previously, it was able to print a backtrace and I even got a core dump. The current behavior makes it almost impossible to debug such a situation and I'm not sure why. No output, no hint, no core dump (when I registered my own terminate handler). Could this be fixed in some way?