https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95221
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> --- You're not wrong, but here we're dealing with the undefined behavior sanitizer whose point is to detect broken code like the above.