https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66223
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |hubicka at gcc dot gnu.org --- Comment #13 from Jan Hubicka <hubicka at gcc dot gnu.org> --- OK, I will keep the current code as I do not see any noticeable code quality cost and it makes life developer's life easier. I will also add logic to disable devirtualization when the list of possible targets contains one cxa_pure_virtual and one real target (this is the case where we take advantage that cxa_pure_virtual call is undefined and we redirect to the real target). I wonder if we want to redirect into better diagnostics in the cases where we know the object instance is of a wrong type. In this case -fsanitize=undefined will claim that __builtin_unreachable was called. We could do better and report that the polymorphic call is undefined becuase there is no instance of an object of the given type or its ancestor. I also wonder if we don't want to generalize __builtin_unreachable code in fixup_cfg and friends that elinates all code when we know the execution will fall into it to sometihng like attribute ((trap)) which can be then assigned to __builtin_trap and C++ undefined effect cruft (cxa_terminate and cxa_pure_virtual)