Bug 399444

Summary: VEX/priv/guest_s390_toIR.c:17407]: (style) Mismatching assignment and comparison
Product: [Developer tools] valgrind Reporter: dcb314
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: arnez
Priority: NOR    
Version First Reported In: 3.13 SVN   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Drop unnecessary check in s390_irgen_VSLDB

Description dcb314 2018-10-06 14:29:55 UTC
SUMMARY

[valgrind/VEX/priv/guest_s390_toIR.c:17401] -> [valgrind/VEX/priv/guest_s390_toIR.c:17407]: (style) Mismatching assignment and comparison, comparison 'imm==16' is always false.

Source code is

   UChar imm = i4 & 0b00001111;

   if (imm == 0)
   {
      put_vr_qw(v1, get_vr_qw(v2));
   }
   else if (imm == 16)
   {
      put_vr_qw(v1, get_vr_qw(v3));

imm can never be equal to 16.

STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE VERSIONS
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Andreas Arnez 2018-10-09 11:03:37 UTC
Created attachment 115505 [details]
Drop unnecessary check in s390_irgen_VSLDB

Trivial patch to remove the unnecessary special-case handling.  If no one objects, I'll push this.
Comment 2 Andreas Arnez 2018-10-10 12:28:06 UTC
(In reply to Andreas Arnez from comment #1)
> Created attachment 115505 [details]
> Drop unnecessary check in s390_irgen_VSLDB
Pushed.  Thanks again for reporting this!
Comment 3 dcb314 2018-10-10 18:33:27 UTC
(In reply to Andreas Arnez from comment #2)
> Pushed.  Thanks again for reporting this!

You are welcome. Not everything that static analyser "cppcheck"
reports is worth fixing, but this one was.

I usually run cppcheck over valgrind once a month or so.