https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69687
--- Comment #11 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- The policy of GNU software is to avoid arbitrary implementation limits whenever possible. (In reply to Marcel Böhme from comment #4) > with n=2*(length of decl + length of arg) characters. Since n is a signed > int, n wraps over at some iteration. Since, realloc expects n to be > unsigned, we end up allocating less memory then actually needed. In the Why n is signed if realloc expects it to be unsigned? Aren't the lengths measured in size_t also? Moreover, it should be trivial to check for overflow before computing n (both from the sum and from *2) by using SIZE_MAX. It should fail only if any intermediate step overflows size_t.