It looks like -Wuse-after-free was added in GCC 12, although it
doesn't appear in the changes. Make suppressing diagnostics about
it in util/xmalloc.c conditional on that version to avoid problems
on GitHub CI with an older GCC version.
* that if realloc fails (which is true in every case when it returns
* NULL when size > 0), p is unchanged and still valid.
*/
* that if realloc fails (which is true in every case when it returns
* NULL when size > 0), p is unchanged and still valid.
*/
+#if __GNUC__ >= 12 && !defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuse-after-free"
#endif
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuse-after-free"
#endif
newp = realloc(p, size);
}
return newp;
newp = realloc(p, size);
}
return newp;
+#if __GNUC__ >= 12 && !defined(__clang__)
# pragma GCC diagnostic pop
#endif
}
# pragma GCC diagnostic pop
#endif
}
* every case when it returns NULL when size > 0 and n > 0), p is
* unchanged and still valid.
*/
* every case when it returns NULL when size > 0 and n > 0), p is
* unchanged and still valid.
*/
+#if __GNUC__ >= 12 && !defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuse-after-free"
#endif
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuse-after-free"
#endif
(*xmalloc_error_handler)("reallocarray", n *size, file, line);
newp = reallocarray(p, n, size);
}
(*xmalloc_error_handler)("reallocarray", n *size, file, line);
newp = reallocarray(p, n, size);
}
+#if __GNUC__ >= 12 && !defined(__clang__)
# pragma GCC diagnostic pop
#endif
return newp;
# pragma GCC diagnostic pop
#endif
return newp;