Skip to contentSkip to conversation

target-tricore: Fix check which was always false

PATCH In review Stefan Weil 3 participants 4 messages Mar 21, 2015 – Mar 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-tricore: Fix check which was always false

With a mask value of 0x00400000, the result will never be 1. This fixes a Coverity warning.

---
 target-tricore/op_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-tricore/op_helper.c +1 -1
index 0e7b4e8..b7d18b2 100644
@@ -2593,7 +2593,7 @@ void helper_rslcx(CPUTriCoreState *env)
         /* CSU trap */
     }
     /* if (PCXI.UL == 1) then trap(CTYP); */
-    if ((env->PCXI & MASK_PCXI_UL) == 1) {
+    if ((env->PCXI & MASK_PCXI_UL) != 0) {
         /* CTYP trap */
     }
     /* EA = {PCXI.PCXS, 6'b0, PCXI.PCXO, 6'b0}; */
Signature · 1 line
2.1.4
#1 lore raw

Hi mjt,

Quoted 13 lines · Stefan Weil

With a mask value of 0x00400000, the result will never be 1. This fixes a Coverity warning.

---
  target-tricore/op_helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target-tricore/op_helper.c +0 -0
index 0e7b4e8..b7d18b2 100644

target-tricore/op_helper.c void helper_rslcx(CPUTriCoreState *env) · line 2599

Quoted 8 lines
target-tricore/op_helper.c +1 -1
@@ -2593,7 +2593,7 @@ void helper_rslcx(CPUTriCoreState *env)
          /* CSU trap */
      }
      /* if (PCXI.UL == 1) then trap(CTYP); */
-    if ((env->PCXI & MASK_PCXI_UL) == 1) {
+    if ((env->PCXI & MASK_PCXI_UL) != 0) {
          /* CTYP trap */
      }
      /* EA = {PCXI.PCXS, 6'b0, PCXI.PCXO, 6'b0}; */

are you picking this one up? It looks good to me.

Cheers,
Bastian

#2 lore raw
In reply to Stefan Weil
Quoted 2 lines · Stefan Weil

With a mask value of 0x00400000, the result will never be 1. This fixes a Coverity warning.

Might be a bit risky if the whole thing wasn't a complete no-op. I wonder maybe the whole this if statement should be removed..

But anyway, applied to -trivial, thank you!

/mjt

Quoted 19 lines
---
 target-tricore/op_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-tricore/op_helper.c +1 -1
index 0e7b4e8..b7d18b2 100644
@@ -2593,7 +2593,7 @@ void helper_rslcx(CPUTriCoreState *env)
         /* CSU trap */
     }
     /* if (PCXI.UL == 1) then trap(CTYP); */
-    if ((env->PCXI & MASK_PCXI_UL) == 1) {
+    if ((env->PCXI & MASK_PCXI_UL) != 0) {
         /* CTYP trap */
     }
     /* EA = {PCXI.PCXS, 6'b0, PCXI.PCXO, 6'b0}; */
#3 lore raw
Quoted 10 lines · Michael Tokarev
Quoted 2 lines · Stefan Weil

With a mask value of 0x00400000, the result will never be 1. This fixes a Coverity warning.

Might be a bit risky if the whole thing wasn't a complete no-op. I wonder maybe the whole this if statement should be removed..

But anyway, applied to -trivial, thank you!

/mjt

Thanks. The statement is just an indicator for a trap which needs to happen there. I'm working on this right now, so it won't stay like this for long :).

Cheers,
Bastian