GNU bug report logs -
#23825
maint: avoid md5sum.c warning from bleeding-edge gcc's -Wstrict-overflow
Previous Next
Reported by: Jim Meyering <jim <at> meyering.net>
Date: Wed, 22 Jun 2016 14:38:02 UTC
Severity: normal
Tags: fixed
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 06/22/2016 04:37 PM, Jim Meyering wrote:
> Building with a recent gcc-7 failed, so I wrote the attached patch. I
> think we'll never have 2^31 command line arguments
I would rather fix the code so that it works even if argc is initially
INT_MAX; the code currently has undefined behavior in that case. I have
drafted a patch for this (attached; does not have changelog entries yet)
and will test it a bit. I assume this will fix the warning (don't have
gcc-7 offhand so can't test this).
As the patch shows, a couple of other coreutils programs have a similar
bug; I'm a bit surprised gcc-7 didn't complain about them.
Incidentally, 'yes' has a different bug: it mishandles the case where
'write' succeeds but returns a value less than the buffer size. I'll try
to look into that too. Simplest would be to use stdio (the comments
indicate this has performance issues but I don't know what they are,
anyway correctness trumps performance).
[coreutils.diff (text/x-patch, attachment)]
This bug report was last modified 6 years and 270 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.