https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108377
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Just adding: if (n+1 == 0) __builtin_unreachable(); Right before the first malloc removes the warning as expected.
pinskia at gcc dot gnu.org via Gcc-bugs Wed, 11 Jan 2023 13:28:31 -0800
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108377
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Just adding: if (n+1 == 0) __builtin_unreachable(); Right before the first malloc removes the warning as expected.