From 1653cee20a466e4a0c80a4c8da1e244657b0a961 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sat, 9 Mar 2019 20:59:06 -0800
Subject: [PATCH] build: avoid spurious build failure with bleeding edge gcc

* configure.ac: Disable -Wnull-dereference for gnulib, to avoid
spurious build warning/error from latest gcc, e.g., 9.0.1 20190310
when configured with --enable-gcc-warnings.
---
 configure.ac | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/configure.ac b/configure.ac
index 0ee01b2cd..511d2b4b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,6 +207,16 @@ if test "$gl_gcc_warnings" = yes; then
   # FIXME: it may be easy to remove this, since it affects only one file:
   # the snprintf call at ftoastr.c:132.
   nw="$nw -Wdouble-promotion"
+
+  # Disable to work around bug in gcc 9.0.1 20190310.
+  # Otherwise, build fails with this:
+  # lib/userspec.c: In function 'parse_with_separator':
+  # lib/userspec.c:202:14: error: potential null pointer dereference \
+  #   [-Werror=null-dereference]
+  #   202 |       grp = (*g == '+' ? NULL : getgrnam (g));
+  #       |              ^~
+  nw="$nw -Wnull-dereference"
+
   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
   AC_SUBST([GNULIB_WARN_CFLAGS])

-- 
2.21.0.135.g6e0cc67761

