https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110437
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> --- The trap was added for PR 104642 because people keep ignoring the -Wreturn-type warning and then complaining that the code misbehaves. Of course now people complain that they prefer the unpredictable undefined behaviour instead of predictable trapping. You can't please everybody.