History

riscv: Fix unsigned 32bit loads

the invariant for the risc-v codegen is, that 64bit regs generally contain the sign-extension of a 32bit value. This wasn't heeded by loads of 32bit values from memory, which used lwu and ultimately caused a miscompilation in string_test of tcctest.c. Now most of tcctest.c works (not with -run, but with linking a real executable), except some ftoi/ftof conversions.

Michael Matz committed 7 years ago

Commit 69c77d11 parent 2668eda1 file · +1 −1Browse files

Unified · Split

riscv64-gen.c+1−1
@@ -155,7 +155,7 @@ ST_FUNC void load(int r, SValue *sv) · 154 unmodified lines
155 if (bt == VT_FUNC)155 if (bt == VT_FUNC)
156 size = PTR_SIZE;156 size = PTR_SIZE;
157 func3 = size == 1 ? 0 : size == 2 ? 1 : size == 4 ? 2 : 3;157 func3 = size == 1 ? 0 : size == 2 ? 1 : size == 4 ? 2 : 3;
158 if (size < 8 && !is_float(sv->type.t) && (sv->type.t & VT_UNSIGNED))158 if (size < 4 && !is_float(sv->type.t) && (sv->type.t & VT_UNSIGNED))
159 func3 |= 4;159 func3 |= 4;
160 }160 }
161 if (v == VT_LOCAL) {161 if (v == VT_LOCAL) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t