Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8322816

RISC-V: Incorrect guarantee in patch_vtype

XMLWordPrintable

    • b05
    • riscv

      The patch_vtype macro (assembler_riscv.hpp) contains a guarantee with the following test expression:

      (vlmul | vsew | vta | vma == 0)

      The error message for this guarantee is "the other bits in vtype shall be zero".

      Because `==` has higher precedence than `|`, this is equivalent to

      (vlmul | vsew | vta | (vma == 0))

      But that doesn't test what the message indicates is being checked. The desired test is

      ((vlmul | vsew | vta | vma) == 0)

      grouping all the bitwise-or's and comparing that result to 0.

      The current code likely doesn't fail the guarantee more or less by accident, because all of the bits being tested _are_ zero. But if any other than vma were non-zero the test would still pass, even though it shouldn't.

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: