https://bugs.kde.org/show_bug.cgi?id=427400

--- Comment #9 from Julian Seward <jsew...@acm.org> ---
All 6 patches look good to me .. OK to land.
I'm always impressed how many test cases you have!

One comment about the helper function deposit_bits_under_mask_helper and
its friends, though.  The way you have it, you are at (serious) risk of
false positive undefined-value uses from Memcheck.  The reason is that
Memcheck doesn't know how definedness flows though the function (from
args to results).  So it assumes the worst: all 64 result bits are
assumed to be undefined if any of the 128 input bits are.

This will give false positives because it's imprecise: if you have an
undefined input bit in `src` that is not selected by `mask`, then that 
undefinedness doesn't propagate to the result.  But Memcheck can't
see that.

One hack you can do is, when generating IR to call the function, instead
of generating just

    deposit_bits_under_mask_helper(src, mask)

generate

    deposit_bits_under_mask_helper(src & mask, mask)

That should help, because it forces any bits of `src` that are not used,
to be defined zeroes.  Then Memcheck's imprecise instrumentation of the
function is OK, because it won't be fooled by undefined `src` bits that
are not used.

I would add -- if you do decide to make this refinement, I suggest you
make a test case that checks my theory is correct.  So far this is just
speculation.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to