Bug 503677

Summary: duplicated-cond compiler warning in dis_RV64M
Product: [Developer tools] valgrind Reporter: correctmost <cmbugz>
Component: vexAssignee: Paul Floyd <pjfloyd>
Status: RESOLVED FIXED    
Severity: normal CC: pjfloyd
Priority: NOR    
Version First Reported In: 3.25 GIT   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description correctmost 2025-05-02 18:57:35 UTC
SUMMARY

This looks harmless, but GCC reports a -Wduplicated-cond warning in VEX/priv/guest_riscv64_toIR.c:

priv/guest_riscv64_toIR.c: In function ‘dis_RV64M’:
priv/guest_riscv64_toIR.c:1758:25: warning: duplicated ‘if’ condition [-Wduplicated-cond]
 1758 |       } else if (funct3 == 0b010) {
      |                  ~~~~~~~^~~~~~~~
priv/guest_riscv64_toIR.c:1756:18: note: previously used here
 1756 |       if (funct3 == 0b010) {
      |           ~~~~~~~^~~~~~~~

Here is the relevant code:

1756      if (funct3 == 0b010) {
1757         /* Invalid {MUL,DIV,REM}<x>, fall through. */
1758      } else if (funct3 == 0b010) {
1759         /* MULHSU, not currently handled, fall through. */
1760      } else {


SOFTWARE/OS VERSIONS

Commit 933e542b431 compiled on Arch Linux
Comment 1 Paul Floyd 2025-05-03 09:14:53 UTC
From what I see here

https://msyksphinz-self.github.io/riscv-isadoc/html/rvm.html

there are no invalid values for bits 14-12.

I think that it should be just

      if (funct3 == 0b010) {
         /* MULHSU, not currently handled, fall through. */
      } else {
Comment 2 Paul Floyd 2025-05-04 06:56:38 UTC
I'll close this if no buildbot fallout.

commit 09c161e6e0ee8ee057d81cfb71c0d98b16f36a19 (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Sun May 4 08:55:45 2025 +0200

    Bug 503677 - duplicated-cond compiler warning in dis_RV64M
Comment 3 Paul Floyd 2025-05-05 09:00:52 UTC
Buildbot didn't complain, closing this.