Commit 9ab6bf2
committed
[cherry-pick] target/riscv: fix ub during instruction decode
A left shift operation caused an implicit integer promotion, triggering
the following UBSan error:
```
left shift of 254 by 24 places cannot be represented in type 'int'
```
NOTE: it seems that this code won't work correctly with BE targets,
however this is a general problem of the whole implementation anyway.
See: riscv-collab/riscv-openocd#1299
Signed-off-by: Anatoly Parshintsev <[email protected]>1 parent f5f712e commit 9ab6bf2
1 file changed
+3
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2390 | 2390 | | |
2391 | 2391 | | |
2392 | 2392 | | |
2393 | | - | |
2394 | 2393 | | |
2395 | 2394 | | |
2396 | 2395 | | |
2397 | | - | |
2398 | | - | |
| 2396 | + | |
| 2397 | + | |
2399 | 2398 | | |
2400 | 2399 | | |
2401 | 2400 | | |
2402 | 2401 | | |
2403 | 2402 | | |
2404 | | - | |
2405 | | - | |
2406 | | - | |
2407 | | - | |
2408 | | - | |
2409 | | - | |
| 2403 | + | |
2410 | 2404 | | |
2411 | 2405 | | |
2412 | 2406 | | |
| |||
0 commit comments