https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103089
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- If I add: if (n <= 0 || m <= 0) __builtin_unreachable(); before the malloc, I get no warning. I think the warning is correct if either n or m is negative.