bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bernhard Voelker <mail@bernhard-voelker.de>
Cc: Bruno Haible <bruno@clisp.org>, bug-gnulib@gnu.org
Subject: Re: test-getgroups.c:stringop-overflow warning on newer GCC
Date: Fri, 1 Jan 2021 19:33:48 -0800	[thread overview]
Message-ID: <42ae568f-9f49-bfb3-fbb8-6437fb8c50e1@cs.ucla.edu> (raw)
In-Reply-To: <1918dba0-3f35-795d-df2c-48e107f725ea@bernhard-voelker.de>

On 1/1/21 6:30 PM, Bernhard Voelker wrote:
> As I see the same on Fedora, the issue seems to be upstream, doesn't it?

I see the problem on Fedora 33 as well. It doesn't appear to be a GCC 
bug. unistd.h's declaration expands to this:

extern int getgroups (int __size, __gid_t __list[]) __attribute__ 
((__nothrow__, __leaf__)) __attribute__ ((__access__ (__write_only__, 2, 
1)));

and the "__write_only__, 2, 1" means that getgroup's 1st argument 
specifies the number of items in the 2nd-argument array, which means if 
the 1st argument is -1 the call is invalid. This checking is enabled by 
-Wstringop-overflow=2 which is the GCC default in 10.2.1.

I am using gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9).


  reply	other threads:[~2021-01-02  3:33 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
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 [this message]
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=42ae568f-9f49-bfb3-fbb8-6437fb8c50e1@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=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).