bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org, Jim Meyering <jim@meyering.net>
Subject: Re: vasnprintf.c vs GCC11's -Wanalyzer-null-argument (and glibc-2.31)
Date: Sat, 2 Jan 2021 19:21:48 -0800	[thread overview]
Message-ID: <9391b43b-e6e1-9aee-833c-be719a3083fd@cs.ucla.edu> (raw)
In-Reply-To: <2624561.TfKlLiq1dV@omega>

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

On 1/2/21 5:49 PM, Bruno Haible wrote:
> The vast majority of -Wanalyzer* warnings that we have seen so far were false
> alarms [1].

I've had such bad luck with those warnings that I have not been much 
motivated to file GCC bug reports for them. I guess the warnings are 
helpful with low-quality code, but I think I've only found one bug with 
them in many months of using them on several GNU projects, as compared 
to a lot of false alarms. I'm almost tempted to disable them in Gnulib 
by default.

For diffutils I worked around the problem by installing the attached 
patch, which disables the warning in Gnulib code.

Without the attached patch I got the same warning that Jim got, when I 
used GCC 10.2.1 20201125 (Red Hat 10.2.1-9) x86-64. I got more warnings 
elsewhere in Gnulib when I used gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0 
x86-64, but I'd rather not work around those bugs as we can just ask 
people to use --disable-gcc-warnings if their GCC is old.

[-- Attachment #2: 0001-maint-work-around-GCC-Wreturn-local-addr-bug.patch --]
[-- Type: text/x-patch, Size: 1046 bytes --]

From f88b033174c4fa816d3b146312820725c658f707 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 2 Jan 2021 19:07:53 -0800
Subject: [PATCH] maint: work around GCC -Wreturn-local-addr bug

* configure.ac: Do not use -Wreturn-local-addr in Gnulib,
to suppress a false alarm in vasnprintf.c.
---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index ef01345..3b2195e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,6 +95,10 @@ if test "$gl_gcc_warnings" = yes; then
   nw="$nw -Wsuggest-attribute=pure"
   nw="$nw -Wduplicated-branches"    # Too many false alarms
 
+  # Avoid false alarm in lib/vasnprintf.c.
+  # https://lists.gnu.org/r/bug-gnulib/2021-01/msg00031.html
+  gl_WARN_ADD([-Wno-analyzer-null-argument])
+
   gl_WARN_ADD([-Wno-return-local-addr])    # avoid this false alarm:
   # careadlinkat.c: In function 'careadlinkat':
   # cc1: error: function may return address of local variable [-Werror=return-local-addr]
-- 
2.27.0


  parent reply	other threads:[~2021-01-03  3:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03  1:11 vasnprintf.c vs GCC11's -Wanalyzer-null-argument (and glibc-2.31) Jim Meyering
2021-01-03  1:49 ` Bruno Haible
2021-01-03  1:54   ` Bruno Haible
2021-01-03  3:21   ` Paul Eggert [this message]
2021-01-03  4:04     ` Bruno Haible
2021-01-03  7:11     ` Jim Meyering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9391b43b-e6e1-9aee-833c-be719a3083fd@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=jim@meyering.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).