[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 <p.stephani2@gmail.com>
> Date: Thu, 19 Jul 2018 08:10:20 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, 32189@debbugs.gnu.org
>
> 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.
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Ken Brown, 2018/07/17
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Eli Zaretskii, 2018/07/18
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Philipp Stephani, 2018/07/19
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Eli Zaretskii, 2018/07/19
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Ken Brown, 2018/07/19
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Eli Zaretskii, 2018/07/19
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Paul Eggert, 2018/07/19
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Eli Zaretskii, 2018/07/20
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Ken Brown, 2018/07/20
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Eli Zaretskii, 2018/07/20
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Ken Brown, 2018/07/20
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2, Paul Eggert, 2018/07/20