From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Bernhard Voelker <mail@bernhard-voelker.de>
Subject: Re: test-getgroups.c:stringop-overflow warning on newer GCC
Date: Fri, 01 Jan 2021 13:56:53 +0100 [thread overview]
Message-ID: <2887419.1QkhuepXuh@omega> (raw)
In-Reply-To: <d6a2d23c-1514-a50b-1e8d-3a749ef647c5@bernhard-voelker.de>
Hi Berny,
Bernhard Voelker wrote in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00090.html>:
> Newer GCC complains about this test:
>
> $ make test-getgroups.o V=1
> depbase=`echo test-getgroups.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -DIN_FINDUTILS_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gl/lib -I./.. \
> /gl/lib -g -O2 -MT test-getgroups.o -MD -MP -MF $depbase.Tpo -c -o test-getgroups.o test-getgroups.c &&\
> mv -f $depbase.Tpo $depbase.Po
> In file included from test-getgroups.c:31:
> test-getgroups.c: In function 'main':
> test-getgroups.c:65:11: warning: argument 1 value -1 is negative [-Wstringop-overflow=]
> 65 | ASSERT (getgroups (-1, NULL) == -1);
> | ^~~~~~~~~~~~~~~~~~~~
I can't reproduce this with a testdir created through
./gnulib-tool --create-testdir --dir=... --single-configure getgroups
and GCC 10.2.0, even with '-Wall' (whereas the GCC invocation that you show does
not invoke any warning options!):
$ gcc -DHAVE_CONFIG_H -I. -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib -I./../gllib -g -O2 -c test-getgroups.c -Wall
(no diagnostics)
Also, it's strange that this warning reports to come from -Wstringop-overflow
— whereas 'getgroups' is not a string operation.
So, to me it looks like a bug in the particular GCC version that you are using.
Under regular circumstances, I would consider adding a #pragma GCC diagnostic,
as you suggest, but not under these circumstances.
Bruno
next prev parent reply other threads:[~2021-01-01 12:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 22:57 test-getgroups.c:stringop-overflow warning on newer GCC Bernhard Voelker
2021-01-01 12:56 ` Bruno Haible [this message]
2021-01-02 1:43 ` Bernhard Voelker
2021-01-02 1:59 ` Bruno Haible
2021-01-02 2:30 ` Bernhard Voelker
2021-01-02 3:33 ` Paul Eggert
2021-01-02 12:51 ` Bruno Haible
2021-01-02 19:21 ` Bernhard Voelker
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=2887419.1QkhuepXuh@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=mail@bernhard-voelker.de \
/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).