https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107300
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org,
| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem related to __builtin_unreachable -> __builtin_trap is during
redirect_to_unreachable, which now calls:
253 struct cgraph_node *target
254 = cgraph_node::get_create (builtin_decl_unreachable ());
and that for -funreachable-traps doesn't return __builtin_unreachable () (which
doesn't need vops) but __builtin_trap () which does.
We have also IFN_TRAP internal call which is like __builtin_trap () except it
doesn't need vops. So, perhaps one way to fix this would be in
redirect_call_stmt_to_callee or in inline_transform to special case
redirections to BUILT_IN_TRAP if the call stmt doesn't have vdef and replace
them with IFN_TRAP call rather than __builtin_trap in that case. A problem is
that internal calls don't have cgraph edges, so we'd need to remove the edge
after the adjustment rather than keep it.
Or redirect_to_unreachable could just builtin_decl_implicit
(BUILT_IN_UNREACHABLE), but then again is a question where if any would we
change it into __ubsan_handle_builtin_unreachable for -fsanitize=unreachable or
__builtin_trap/IFN_TRAP later on.