https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91397
--- Comment #9 from Steinar H. Gunderson <steinar+gcc at gunderson dot no> --- Putting this at the start of mem_strdupl() suppresses the warning: if (len + 1 == 0) __builtin_unreachable(); This seemingly also does: if (static_cast<long>(len) < 0) __builtin_unreachable(); So somehow, even though it knows that path >= last_slash (from before), it doesn't know that last_slash - path >= 0. I don't know how easy or hard this is to infer.