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

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

bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2


From: Eli Zaretskii
Subject: bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2
Date: Thu, 19 Jul 2018 16:25:09 +0300

> From: Philipp Stephani <address@hidden>
> Date: Thu, 19 Jul 2018 08:10:20 +0200
> Cc: Eli Zaretskii <address@hidden>, address@hidden
> 
>  This doesn't work with GCC 7.  (Maybe it would work with GCC 8; the 
>  release notes say that it is better at avoiding false positives.)  For 
>  integer specifiers like "%ld", the only thing I've found that works 
>  without enlarging the buffer is to cast the argument to a smaller 
>  integer type. 
> 
> You can't do that; %ld requires a long argument, and casting results in 
> undefined behavior.

We can assign instead, and since the value is known to be small
enough, doing that won't lose bits.





reply via email to

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