]> Git Repo - qemu.git/commit
target/arm: Remove can't-happen if() from handle_vec_simd_shli()
authorPeter Maydell <[email protected]>
Tue, 6 Nov 2018 11:32:13 +0000 (11:32 +0000)
committerPeter Maydell <[email protected]>
Tue, 6 Nov 2018 11:32:13 +0000 (11:32 +0000)
commitf6c98f91f56031141a47f86225fdc30f0f9f84fb
treee8ec22d1390d0f0c129b27d03af408a34e73fc5e
parent03c1ca1c51783603d42eb0f91d35961f0f4b4947
target/arm: Remove can't-happen if() from handle_vec_simd_shli()

In handle_vec_simd_shli() we have a check:
     if (size > 3 && !is_q) {
         unallocated_encoding(s);
         return;
     }
However this can never be true, because we calculate
    int size = 32 - clz32(immh) - 1;
where immh is a 4 bit field which we know cannot be all-zeroes.
So the clz32() return must be in {28,29,30,31} and the resulting
size is in {0,1,2,3}, and "size > 3" is never true.

This unnecessary code confuses Coverity's analysis:
in CID 1396476 it thinks we might later index off the
end of an array because the condition implies that we
might have a size > 3.

Remove the code, and instead assert that the size is in [0..3],
since the decode that enforces that is somewhat distant from
this function.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Tested-by: Alex Bennée <[email protected]>
Message-id: 20181030162517[email protected]
target/arm/translate-a64.c
This page took 0.022834 seconds and 4 git commands to generate.