qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

mem2.ssa (581B)


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