Bug 503677 - duplicated-cond compiler warning in dis_RV64M
Summary: duplicated-cond compiler warning in dis_RV64M
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (other bugs)
Version First Reported In: 3.25 GIT
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-02 18:57 UTC by correctmost
Modified: 2025-05-05 09:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.