https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117267
--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> --- If the program never executes the code with UB, then the program is correct, and refusing to compile it with an error would be non-conforming. A warning would be OK.