summaryrefslogtreecommitdiffhomepage
path: root/ir/be
diff options
context:
space:
mode:
authorJohannes Bucher <johannes.bucher2@student.kit.edu>2019-05-17 10:52:33 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-05-17 10:52:33 +0200
commit0b22246bd37ea4d4fb772caf659fa7d449571e3a (patch)
tree72238940d0c270531b9c578b842e54965a5423e1 /ir/be
parent2a541cb084f6a822e7b99a23340973d5666a35ab (diff)
riscv: fix calculation of hi lo immediate (remove undefined behavior)
fixes runtime error in sanitize builds
Diffstat (limited to 'ir/be')
-rw-r--r--ir/be/riscv/riscv_bearch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ir/be/riscv/riscv_bearch.c b/ir/be/riscv/riscv_bearch.c
index 2eedaa1..7b489a7 100644
--- a/ir/be/riscv/riscv_bearch.c
+++ b/ir/be/riscv/riscv_bearch.c
@@ -51,7 +51,7 @@ riscv_hi_lo_imm calc_hi_lo(int32_t val) {
if (hi >= 1048576) { //2^20
hi = 0;
}
- int32_t const lo = (uint32_t) val - (hi << 12);
+ int32_t const lo = (uint32_t) val - ((uint32_t) hi << 12);
return (riscv_hi_lo_imm) {hi, lo};
}