* [PATCH] target/ppc: fix unreachable code in fpu_helper.c
@ 2022-06-02 19:10 Daniel Henrique Barboza
2022-06-02 20:00 ` Lucas Mateus Martins Araujo e Castro
2022-06-06 17:50 ` Daniel Henrique Barboza
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Henrique Barboza @ 2022-06-02 19:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, clg, Daniel Henrique Barboza, Lucas Mateus Castro,
Richard Henderson
Commit c29018cc7395 added an env->fpscr OR operation using a ternary
that checks if 'error' is not zero:
env->fpscr |= error ? FP_FEX : 0;
However, in the current body of do_fpscr_check_status(), 'error' is
granted to be always non-zero at that point. The result is that Coverity
is less than pleased:
Control flow issues (DEADCODE)
Execution cannot reach the expression "0ULL" inside this statement:
"env->fpscr |= (error ? 1073...".
Remove the ternary and always make env->fpscr |= FP_FEX.
Cc: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Cc: Richard Henderson <richard.henderson@linaro.org>
Fixes: Coverity CID 1489442
Fixes: c29018cc7395 ("target/ppc: Implemented xvf*ger*")
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/fpu_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index fed0ce420a..7ab6beadad 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -464,7 +464,7 @@ static void do_fpscr_check_status(CPUPPCState *env, uintptr_t raddr)
}
cs->exception_index = POWERPC_EXCP_PROGRAM;
env->error_code = error | POWERPC_EXCP_FP;
- env->fpscr |= error ? FP_FEX : 0;
+ env->fpscr |= FP_FEX;
/* Deferred floating-point exception after target FPSCR update */
if (fp_exceptions_enabled(env)) {
raise_exception_err_ra(env, cs->exception_index,
--
2.36.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/ppc: fix unreachable code in fpu_helper.c
2022-06-02 19:10 [PATCH] target/ppc: fix unreachable code in fpu_helper.c Daniel Henrique Barboza
@ 2022-06-02 20:00 ` Lucas Mateus Martins Araujo e Castro
2022-06-06 17:50 ` Daniel Henrique Barboza
1 sibling, 0 replies; 3+ messages in thread
From: Lucas Mateus Martins Araujo e Castro @ 2022-06-02 20:00 UTC (permalink / raw)
To: Daniel Henrique Barboza, qemu-devel; +Cc: qemu-ppc, clg, Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 1247 bytes --]
On 02/06/2022 16:10, Daniel Henrique Barboza wrote:
> Commit c29018cc7395 added an env->fpscr OR operation using a ternary
> that checks if 'error' is not zero:
>
> env->fpscr |= error ? FP_FEX : 0;
>
> However, in the current body of do_fpscr_check_status(), 'error' is
> granted to be always non-zero at that point. The result is that Coverity
> is less than pleased:
>
> Control flow issues (DEADCODE)
> Execution cannot reach the expression "0ULL" inside this statement:
> "env->fpscr |= (error ? 1073...".
>
> Remove the ternary and always make env->fpscr |= FP_FEX.
>
> Cc: Lucas Mateus Castro (alqotel)<lucas.araujo@eldorado.org.br>
> Cc: Richard Henderson<richard.henderson@linaro.org>
> Fixes: Coverity CID 1489442
> Fixes: c29018cc7395 ("target/ppc: Implemented xvf*ger*")
> Signed-off-by: Daniel Henrique Barboza<danielhb413@gmail.com>
> ---
>
Reviewed-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
--
Lucas Mateus M. Araujo e Castro
Instituto de Pesquisas ELDORADO
<https://www.eldorado.org.br/?utm_campaign=assinatura_de_e-mail&utm_medium=email&utm_source=RD+Station>
Departamento Computação Embarcada
Analista de Software Trainee
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>
[-- Attachment #2: Type: text/html, Size: 2075 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/ppc: fix unreachable code in fpu_helper.c
2022-06-02 19:10 [PATCH] target/ppc: fix unreachable code in fpu_helper.c Daniel Henrique Barboza
2022-06-02 20:00 ` Lucas Mateus Martins Araujo e Castro
@ 2022-06-06 17:50 ` Daniel Henrique Barboza
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Henrique Barboza @ 2022-06-06 17:50 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-ppc, clg, Lucas Mateus Castro, Richard Henderson
Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,
Daniel
On 6/2/22 16:10, Daniel Henrique Barboza wrote:
> Commit c29018cc7395 added an env->fpscr OR operation using a ternary
> that checks if 'error' is not zero:
>
> env->fpscr |= error ? FP_FEX : 0;
>
> However, in the current body of do_fpscr_check_status(), 'error' is
> granted to be always non-zero at that point. The result is that Coverity
> is less than pleased:
>
> Control flow issues (DEADCODE)
> Execution cannot reach the expression "0ULL" inside this statement:
> "env->fpscr |= (error ? 1073...".
>
> Remove the ternary and always make env->fpscr |= FP_FEX.
>
> Cc: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Fixes: Coverity CID 1489442
> Fixes: c29018cc7395 ("target/ppc: Implemented xvf*ger*")
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
> target/ppc/fpu_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
> index fed0ce420a..7ab6beadad 100644
> --- a/target/ppc/fpu_helper.c
> +++ b/target/ppc/fpu_helper.c
> @@ -464,7 +464,7 @@ static void do_fpscr_check_status(CPUPPCState *env, uintptr_t raddr)
> }
> cs->exception_index = POWERPC_EXCP_PROGRAM;
> env->error_code = error | POWERPC_EXCP_FP;
> - env->fpscr |= error ? FP_FEX : 0;
> + env->fpscr |= FP_FEX;
> /* Deferred floating-point exception after target FPSCR update */
> if (fp_exceptions_enabled(env)) {
> raise_exception_err_ra(env, cs->exception_index,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-06 17:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-02 19:10 [PATCH] target/ppc: fix unreachable code in fpu_helper.c Daniel Henrique Barboza
2022-06-02 20:00 ` Lucas Mateus Martins Araujo e Castro
2022-06-06 17:50 ` Daniel Henrique Barboza
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).