isel fix for amd64 memory stores

The value argument of store instructions was
handled incorrectly.
This commit is contained in:
Quentin Carbonneaux 2019-04-30 11:02:42 +02:00
parent 660a8d9dfa
commit 4b7f02c097
2 changed files with 31 additions and 20 deletions

View file

@ -34,6 +34,13 @@ function l $f3(l %o) {
ret %addr
}
export
function $f4() {
@start
storel $p, $p
ret
}
export
function $writeto0() {
@start
@ -45,13 +52,14 @@ function $writeto0() {
# #include <stdlib.h>
# #include <signal.h>
# char a[] = "qbe rocks";
# void *p;
# int ok;
# extern unsigned f0(long), f1(long), f2(long, long);
# extern char *f3(long);
# extern void writeto0();
# extern void f4(), writeto0();
# void h(int sig, siginfo_t *si, void *unused) {
# ok += si->si_addr == 0;
# exit(!(ok == 5));
# exit(!(ok == 6));
# }
# int main() {
# struct sigaction sa = {.sa_flags=SA_SIGINFO, .sa_sigaction=h};
@ -60,6 +68,8 @@ function $writeto0() {
# ok += f1((long)a-5) == 'o';
# ok += f2(4, 2) == 's';
# ok += *f3(0) == 'q';
# f4();
# ok += p == &p;
# writeto0(); /* will segfault */
# }
# <<<