I want to make bubble sort algorithm and I get this error. How to solve it?
.data
.text
main:
add $s0, $s0, $0
Loop1: slti $t0, $s0, 5
bne $t0, $0, Loop2
j Exit
Loop2: addi $s1, $s0, 1
slti $t1, $s1, 5
bne $t1, $0, check
j Loop1
check: sll $t2, $s0, 2
add $t2, $t2, $s6
lw $s2, 0($t2) #Line 18
add $t3, $0, $s2
sll $t4, $s1, 2
add $t4, $t4, $s6
lw $t4, 0($t4)
slt $t5, $t4, $t3
bne $t5, $0, swap
swap: sw $t4, 0($t3)
sw $s2, 0($t4)
j Loop2
Exit:
line 18: Runtime exception at 0x00400028: address out of range 0x00000000
User contributions licensed under CC BY-SA 3.0