https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92289
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- If you don't want to see a warning, add [[noreturn]] attribute to throw_sum, -Wreturn-type is an early (front-end) warning, while to find out that throw_sum never returns requires interprocedural analysis which is done much later, at a point where a warning like -Wreturn-type can't be implemented as on the other side a lot of information and potential code paths are lost due to optimizations. Furthermore, -fsanitize= does affect warning diagnostics a lot and there is no way around that in most cases, we don't want to compile everything twice just to give better warnings because not everyone needs that, and you can do that yourself anyway (compile twice, once with -fsanitize=undefined -w and once without sanitization with -Wall -Wextra or whatever you want).