https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66223
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- 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?