[Bug tree-optimization/88889] [9 Regression] New valgrind warning since r261039

jseward at acm dot org gcc-bugzilla@gcc.gnu.org
Thu Jan 17 12:02:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88889

--- Comment #7 from jseward at acm dot org ---
(In reply to Jakub Jelinek from comment #3)
> Because, say in the memcmp case, if the first 4 bytes are defined and are
> not equal to the first bytes of the other value, then it will be non-equal
> regardless of what the other bytes contain.  Now, this should be only done
> if the comparison is consumed as equality comparison by the conditional
> jump, if it is >/>=/</<=, then obviously all bytes matter.

The core observation is: for == and !=, if it is possible to find two 
corresponding bits that are different and both defined, then the result
of the comparison is defined (because == says "No" and != says "Yes")

For <, <=, >, >= etc, Memcheck has various levels of sophistication.  For
example it knows that |value <signed 0| simply returns the top bit of |value|.


More information about the Gcc-bugs mailing list