From c7c18db6db17f3f25b6fabbf2d243fcd67283ebb Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 27 Jun 2024 15:39:15 +0200 Subject: [PATCH] work around GCC bug 108860 GCC 12/13/14 can emit spurious warnings for something as innocent as vec.insert(vec.begin(), 12)... Reported by Antoine Martin and Quentin Rataud. * m4/gccwarn.m4: Test the above code and disable GCC's -Wnull-dereference warning if necessary. --- m4/gccwarn.m4 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/m4/gccwarn.m4 b/m4/gccwarn.m4 index 13f770ccc..091006af7 100644 --- a/m4/gccwarn.m4 +++ b/m4/gccwarn.m4 @@ -21,6 +21,7 @@ AC_DEFUN([CF_GXX_WARNINGS], cat > conftest.$ac_ext < +#include #include // From GCC bug 106159 @@ -29,6 +30,13 @@ struct left { virtual ~left() {} }; struct right { virtual ~right() {} }; struct both: public left, public right {}; +// For GCC bug 108860 +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108860 +void test(std::vector& v) +{ + v.insert(v.begin(), 12); +} + int main(int argc, char *argv[[]]) { // This string comparison is here to detect superfluous