shithub: mc

Download patch

ref: 5200a362df2c9d6a58cc414ff915a2e16006e904
parent: 57e6fd0760167a9e9b39a6c9212ef3292297380e
author: Ori Bernstein <[email protected]>
date: Mon May 14 05:53:47 EDT 2012

Return correct result register.

    We returned the source, not the dest. Fix.

--- a/8/isel.c
+++ b/8/isel.c
@@ -432,7 +432,7 @@
             a = selexpr(s, args[0]);
             b = getreg(s, a.mode);
             load(s, &b, &a);
-            r = b;
+            r = a;
             break;
 
         case Ocall: die("Unimplemented op %s", opstr(exprop(n))); break;
--- /dev/null
+++ b/a.s
@@ -1,0 +1,24 @@
+.globl _main
+_main:
+	pushl %ebp
+	movl %esp,%ebp
+	subl $12,%esp
+	jmp .L2
+.L1:
+	movl 4(%esp),%eax
+	addl (%esp),%eax
+	movl %eax,4(%esp)
+.L2:
+	movl (%esp),%eax
+	cmpl $10,%eax
+	jl .L1
+	jmp .L3
+.L3:
+	movl 4(%esp),%eax
+	movl %eax,(%esp)
+	jmp .L0
+.L0:
+	movl (%esp),%eax
+	movl %ebp,%esp
+	popl %ebp
+	ret