qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcg/optimize: Add an extra cast to fold_extract2
@ 2021-11-10 12:01 Richard Henderson
  2021-11-10 12:26 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2021-11-10 12:01 UTC (permalink / raw)
  To: qemu-devel

There is no bug, but silence a warning about computation
in int32_t being assigned to a uint64_t.

Reported-by: Coverity CID 1465220
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/optimize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/optimize.c b/tcg/optimize.c
index dbb2d46e88..2397f2cf93 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1365,7 +1365,7 @@ static bool fold_extract2(OptContext *ctx, TCGOp *op)
             v2 <<= 64 - shr;
         } else {
             v1 = (uint32_t)v1 >> shr;
-            v2 = (int32_t)v2 << (32 - shr);
+            v2 = (uint64_t)((int32_t)v2 << (32 - shr));
         }
         return tcg_opt_gen_movi(ctx, op, op->args[0], v1 | v2);
     }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tcg/optimize: Add an extra cast to fold_extract2
  2021-11-10 12:01 [PATCH] tcg/optimize: Add an extra cast to fold_extract2 Richard Henderson
@ 2021-11-10 12:26 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-10 12:26 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

On 11/10/21 13:01, Richard Henderson wrote:
> There is no bug, but silence a warning about computation
> in int32_t being assigned to a uint64_t.
> 
> Reported-by: Coverity CID 1465220
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tcg/optimize.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-10 12:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-10 12:01 [PATCH] tcg/optimize: Add an extra cast to fold_extract2 Richard Henderson
2021-11-10 12:26 ` Philippe Mathieu-Daudé

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).