https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108377
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So we have: const __SIZE_TYPE__ n = calc_n(259); #if 1 haystack = __builtin_malloc(n + 1); if (!haystack) __builtin_abort(); for (__SIZE_TYPE__ i = 0; i < n + 1; ++i) haystack[i] = '0'; #endif needle = __builtin_malloc(n); If calc_n(259) returns (__SIZE_TYPE__)-1 (aka 18446744073709551615). n+1 would be 0 which will is fine for malloc. and then the for is skipped if n+1 == 0 and a jump threading happens so you get two copies of the second malloc and then you get a malloc which has 18446744073709551615. So the warning is correct (and code produced) in some sense of correctness. Maybe the best thing is add an assume after the call to calc_n that it will be small or smaller than the n or so.