mem2.ssa 581 B

1234567891011121314151617181920212223242526272829303132
  1. # Ember Sawady reported this bug
  2. # in stack-slot coalescing
  3. type :t = { w 2 }
  4. function :t $func() {
  5. @start.0
  6. %temp =l alloc4 4
  7. %ret =l alloc4 8
  8. storew 1, %temp
  9. # storew can also go here
  10. %field =l add %ret, 4
  11. storew 2, %ret
  12. blit %temp, %field, 4
  13. # removing either of these storews causes it to work
  14. storew 2, %ret
  15. ret %ret
  16. }
  17. export function w $main() {
  18. @start
  19. %ret =:t call $func()
  20. %fptr =l add %ret, 4
  21. %field =w loaduw %fptr
  22. %x =w ceqw %field, 1
  23. jnz %x, @passed, @failed
  24. @failed
  25. # this fails despite 1 => temp => ret + 4 => field
  26. call $abort()
  27. @passed
  28. ret 0
  29. }