On 7/20/22 19:27, Daniel Henrique Barboza wrote:
Coverity reports that commit fc34e81acd51 ("target/ppc: add macros to
check privilege level") turned the following code unreachable:
if (!prefixed && !(ctx->insns_flags2 & PPC2_LSQ_ISA207)) {
/* lq and stq were privileged prior to V. 2.07 */
REQUIRE_SV(ctx);
CID 1490757: Control flow issues (UNREACHABLE)
This code cannot be reached: "if (ctx->le_mode) {
if (ctx->le_mode) {
gen_align_no_le(ctx);
return true;
}
}
This happens because the macro REQUIRE_SV(), in CONFIG_USER_MODE, will
always result in a 'return true' statement.
I think adding ifdefs isn't fantastic. This isn't actually fix a bug, so we *could* just
mark this as ignore in Coverity.
If you wanted to clean this up, remove the implicit control flow from REQUIRE_* and turn
the macros into pure predicates, so that you get
if (REQUIRE_SV(ctx)) {
return true;
}
if (ctx->le_mode) {
...
}
r~