diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-10-08 12:35:36 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-10-08 12:48:51 +0100 |
commit | 16c7267d7425fe59b6919e77fa572d104d72c2bf (patch) | |
tree | c3801552e2f534e5ac80f2a0151d37f9403b59f9 /src/shred.c | |
parent | fcbbf1cdb8cf65cdbb47522e9e7eefcbe752406e (diff) | |
download | coreutils-16c7267d7425fe59b6919e77fa572d104d72c2bf.tar.xz |
maint: avoid new signed overflow warning on 32 bit
Prompted by http://hydra.nixos.org/build/15682577
with GCC 4.8.3 on i686
src/tac.c:557:6: error: assuming signed overflow does not occur
when simplifying conditional to constant [-Werror=strict-overflow]
if (bytes_copied < 0)
This happens because copy_to_temp() is inlined in tac_nonseekable(),
thus reducing the comparison to the bytes_copied variable in
copy_to_temp. Now this can't overflow on either 32 or 64 bit
due to the protection of the preceding fwrite(). We could use a
guard like "if (bytes_copied <= OFF_T_MAX - bytes_read)" to avoid
the warning, but rather than a runtime branch, just use an unsigned
type to avoid apparent signed overflow on systems where the accumulation
is not promoted to unsigned (32 bit size_t, 64 bit off_t).
* src/tac.c (copy_to_temp): Increment an unsigned type to
avoid the subsequent signed overflow warning.
Diffstat (limited to 'src/shred.c')
0 files changed, 0 insertions, 0 deletions