<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/140701>140701</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Clang ignores parameter for C23 gnu::interrupt attribute on RISC-V64
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MofX
      </td>
    </tr>
</table>

<pre>
    When trying to create a supervisor trap handler on RISC-V64 using C23 attribute syntax, the parameter "supervisor" seems to be ignored and a machine trap handler is generated.

I.e. the following snipped generates an `mret` instead of an `sret` for the `c23` variant, while the correct one is generated for the `pre_c23` variant:
```
__attribute__((interrupt("supervisor"))) void pre_c23(){}

[[gnu::interrupt("supervisor")]] void c23(){}
```

gcc generates the correct code in both variants, see also in compiler explorer: https://godbolt.org/z/zeEjM8f5E
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEU0FvozoQ_jXmMmpkbAjxgUOaNFIPvbwnvbe3yOABXBkb2SZt99evTNKWdldayQjweOb75ht_MgTdW8SalPekPGZyjoPz9ZPrfmSNU2_1_wNaiP5N2x6ig9ajjAgSwjyhv-jgPEQvJxikVQY9OAv_PP57uPtvW8AcUtaBcZAxet3MESG82ShfCTtAHBAm6eWIET0Qxj5LEsYgII4hQTYIurfOowJpFUgYZTtoi19xdYAeLXoZUW0I3RO6f9zgZkHpnDHuJXEJVk8Tqo-jAaQFsqWjx0i2FLQNEaUC190C4RboUp8Dpq2W8bRzkV5LG1MnL4M2uIRb5z22EZzFL4zW-ZPH87caPNElW3pbdH8-fyh2PhO2I2ynbUTv5ykuv1_FIkxcF1ycVvCOkA4KUt2T6nhVZBnyfW_nhMj3fytZHkl5vJb8Q7kVXUL3fduuVF1r0TqFoC00Lg7vHYckW0AEaYJLwdaNk05zxNfJOI-e8D0MMU4hUWUnwk69U40zceN8T9jpZ3rw4flp15UPmaq5ElzIDOu8KqqKlyzPs6EWuRCirXYcmw47ui0EKlU0nIudwq2Qma4ZZSUtGc0ppTndiJJyITjtdopXTclJQXGU2myMuYwJO9MhzFjnBa1onhnZoAmLexhrjbR90q48Zr5OCXfN3AdSUKNDDJ8loo5msdw1ozzCIX3c7nlY2SLdm2Sg32e28tTKc9nsTf1NNx2Hudm0biTslCjcXneTd8_YRsJOS0uBsNOtq0vNfgUAAP__31JQJw">