Subject: Re: bug#44535: grep-3.6 released [stable]

From: Paul Eggert <[email-masked]>
Date: Sat, 21 Nov 2020 18:15:20 -0800

On 11/12/20 11:39 PM, Paul Eggert wrote:
> We have dueling compilers here, as Sun C complains if the return statements are 
> present[1], whereas gcc -Wreturn-type complains if they're absent. Since the 
> return statements are clearly bogus and unnecessary I'm inclined to continue to 
> omit them.

I looked into this some more, and found out that it's a known GCC bug. I 
installed the attached patch into Gnulib to work around the bug. Thanks for 
reporting the problem.
>From f60dd0747ad75c2971cc314111c8fc2b8a38ce19 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sat, 21 Nov 2020 18:09:29 -0800
Subject: [PATCH] nl_langinfo-tests: work around GCC bug 44511

* tests/test-nl_langinfo-mt.c: Ignore -Wreturn-type, to work
around a GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44511>.
Problem reported for GNU grep by Andreas Schwab
<https://bugs.gnu.org/44535>.
---
 ChangeLog                   | 6 ++++++
 tests/test-nl_langinfo-mt.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 745a90097..d46bfbb1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2020-11-21  Paul Eggert  <[email-masked]>
 
+	nl_langinfo-tests: work around GCC bug 44511
+	* tests/test-nl_langinfo-mt.c: Ignore -Wreturn-type, to work
+	around a GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44511>.
+	Problem reported for GNU grep by Andreas Schwab
+	<https://bugs.gnu.org/44535>.
+
 	selinux-h: add stubs for selabel_open etc.
 	Coreutils with --enable-gcc-warnings does not build on Ubuntu 20.10
 	because matchpathcon is deprecated in favor of selabel_open etc.,
diff --git a/tests/test-nl_langinfo-mt.c b/tests/test-nl_langinfo-mt.c
index 4d207f1be..751008ff9 100644
--- a/tests/test-nl_langinfo-mt.c
+++ b/tests/test-nl_langinfo-mt.c
@@ -18,6 +18,11 @@
 
 #include <config.h>
 
+/* Work around GCC bug 44511.  */
+#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
+# pragma GCC diagnostic ignored "-Wreturn-type"
+#endif
+
 #if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
 
 /* Specification.  */
-- 
2.27.0