In perl.git, the branch smoke-me/davem/mem_wrap_check2 has been created
<http://perl5.git.perl.org/perl.git/commitdiff/f123066d61e1073b26c17e8cc5a4be3a78a2656e?hp=0000000000000000000000000000000000000000>
at f123066d61e1073b26c17e8cc5a4be3a78a2656e (commit)
- Log -----------------------------------------------------------------
commit f123066d61e1073b26c17e8cc5a4be3a78a2656e
Author: David Mitchell <[email protected]>
Date: Thu Feb 26 18:42:16 2015 +0000
Make MEM_WRAP_CHECK more compile-time
MEM_WRAP_CHECK(n,t) checks whether n * sizeof(t) exceeds the
memory size, and so is likely to wrap.
When the type of n is small (e.g. a U8), you used to get compiler warnings
about a comparison always being true. This was avoided by adding 0.0. Now
Coverity complains that you're doing a floating-point comparison with the
results of an integer division.
Instead of adding 0.0, instead add some more compile-time checks
that will cause the runtime check to be skipped when the maximum value
of n (as determined by sizeof(n)) is a lot less than memory size.
On my 64-bit system this also pleasingly makes the executable 8384 bytes
smaller, implying that in many cases, the run-time check is now being
skipped.
-----------------------------------------------------------------------
--
Perl5 Master Repository