GNU bug report logs - #32230
27.0.50; GCC 7 warning due to -Wformat-overflow

Previous Next

Package: emacs;

Reported by: Ken Brown <kbrown <at> cornell.edu>

Date: Fri, 20 Jul 2018 22:03:01 UTC

Severity: normal

Found in version 27.0.50

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ken Brown <kbrown <at> cornell.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 32230 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: bug#32230: 27.0.50; GCC 7 warning due to -Wformat-overflow
Date: Sat, 21 Jul 2018 08:42:09 -0400
On 7/21/2018 3:26 AM, Eli Zaretskii wrote:
>> Date: Sat, 21 Jul 2018 09:53:04 +0300
>> From: Eli Zaretskii <eliz <at> gnu.org>
>> Cc: 32230 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
>>
>> But do you understand why it says "between 5 and 8 bytes"?  The
>> corresponding argument to snprintf is either 4 or 6, so it should be
>> between 5 and 7.  Where could the extra byte come from?  Is that
>> because glyphless.ch is a 25-bit field?

Yes.  Changing the field size to 24 silences the warning.

> I meant sprintf, of course.  And if the above is the reason, then
> perhaps using something like
> 
>    (unsigned int) glyph->u.glyphless.ch & 0xffffff
> 
> is a cleaner solution (assuming it shuts up the warning)?

Yes, it does shut up the warning.  Thanks, I'll make that change.  I 
assume it should go to master, or would you rather have it in the 
emacs-26 branch?

Ken





This bug report was last modified 7 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.