https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112962
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- On the other side, maybe we want some of the diagnostics that is only done at expansion time (argument xyz must be such and such immediate). Though, at -O2 it isn't diagnosed anyway because it is DCEd. Anyway, with just -O0 -mssse3 this works fine because of expr.cc: 11097 /* If we are going to ignore this result, we need only do something 11098 if there is a side-effect somewhere in the expression. If there 11099 is, short-circuit the most common cases here. Note that we must 11100 not call expand_expr with anything but const0_rtx in case this 11101 is an initial expansion of a size that contains a PLACEHOLDER_EXPR. */ 11102 11103 if (ignore) 11104 { 11105 if (! TREE_SIDE_EFFECTS (exp)) 11106 return const0_rtx; but with -fexceptions (and probably because we incorrectly don't mark the builtins nothrow?) this doesn't happen. I was thinking about something like --- gcc/i386-expand.cc.jj 2023-12-07 08:31:59.855850982 +0100 +++ gcc/i386-expand.cc 2023-12-12 11:02:54.524733315 +0100 @@ -11842,6 +11842,12 @@ ix86_expand_args_builtin (const struct b xops[i] = op; } + if (icode == CODE_FOR_nothing) + { + gcc_assert (target == const0_rtx); + return const0_rtx; + } + switch (nargs) { case 1: but of course, your choice...