bugfix a register allocation.
add testcase.