bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32230: 27.0.50; GCC 7 warning due to -Wformat-overflow


From: Ken Brown
Subject: bug#32230: 27.0.50; GCC 7 warning due to -Wformat-overflow
Date: Sat, 21 Jul 2018 08:42:09 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 7/21/2018 3:26 AM, Eli Zaretskii wrote:
Date: Sat, 21 Jul 2018 09:53:04 +0300
From: Eli Zaretskii <eliz@gnu.org>
Cc: 32230@debbugs.gnu.org, eggert@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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]