]> Savannah Git Hosting - gnulib.git/commitdiff
careadlinkat: limit GCC workaround
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 May 2020 00:07:47 +0000 (17:07 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 May 2020 00:08:23 +0000 (17:08 -0700)
* lib/careadlinkat.c (careadlinkat): Limit workaround to GCC
10.1.0 and later, since the workaround is pretty bad and the GCC
bug should get fixed.

ChangeLog
lib/careadlinkat.c

index 6ef88249c7e58d8344ec5a82dc3a8af33d34f4a1..7468718c3ea8a0b0c16a5714131c35514a2fb153 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       careadlinkat: limit GCC workaround
+       * lib/careadlinkat.c (careadlinkat): Limit workaround to GCC
+       10.1.0 and later, since the workaround is pretty bad and the GCC
+       bug should get fixed.
+
 2020-05-10  Bruno Haible  <bruno@clisp.org>
 
        havelib: Enhance documentation.
index e1f8305e9b34f93878cf5a665e1831c9de6a07dc..fbed634f9c6a7b1ebc8383a1ea2f2ed4a8783bcf 100644 (file)
@@ -71,9 +71,14 @@ careadlinkat (int fd, char const *filename,
   size_t buf_size_max =
     SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
 
-#if defined GCC_LINT || defined lint
+#if (defined GCC_LINT || defined lint) && _GL_GNUC_PREREQ (10, 1)
   /* Pacify preadlinkat without creating a pointer to the stack
-     that gcc -Wreturn-local-addr would cry wolf about.  */
+     that a broken gcc -Wreturn-local-addr would cry wolf about.  See:
+     https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95044
+     This workaround differs substantially from the mainline code, but
+     no other way to pacify GCC 10.1.0 is known; even an explicit
+     #pragma does not pacify GCC.  When the GCC bug is fixed this
+     workaround should be limited to the broken GCC versions.  */
   static char initial_buf[1];
   enum { initial_buf_size = 0 }; /* 0 so that initial_buf never changes.  */
 #else