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).