Skip to content

Commit

Permalink
Fix issue253.c:
Browse files Browse the repository at this point in the history
Use def_op_num in process_insn_to_rename.
Permit mir as add file in runtests.sh.
Add issue253.c, add-issue253.mir, and issue253.expect.
  • Loading branch information
vnmakarov committed Dec 21, 2023
1 parent 7e8a9ed commit 7b6c506
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
26 changes: 26 additions & 0 deletions c-tests/new/add-issue253.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
iteration: module
export iteration
import print_identity
import print_and_return_zero
_proto_1: proto p, p:a0
_proto_2: proto i32, p:a0
iteration: func p, p:a0
local i64:x2, i64:x1, i64:z1
# 2 args, 4 locals
mov x1, a0
mov x2, 0
L1:
bf L3, x2
bt L3, i64:(x2)
L3:
call _proto_1, print_identity, x2, x1
call _proto_2, print_and_return_zero, z1, x2
bt L4, z1
jmp L5
L4:
jmp L1
L5:
ret x1
ret x2
endfunc
endmodule
18 changes: 18 additions & 0 deletions c-tests/new/issue253.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>
void* print_identity (void* x) {
printf ("in print_identity: %p\n", x);
return x;
}

int print_and_return_zero (void* t) {
printf ("in print_and_return_zero: %p\n", t);
return 0;
}

extern void* iteration (void*);
void* (*v) (void*) = iteration;

int main (void) {
v ((void*) 0xdeadbeaf);
return 0;
}

0 comments on commit 7b6c506

Please sign in to comment.