0

可能重复:
编译时初始化数组错误

我正在尝试从编译时间初始化的数组中加载数据。但是当我尝试加载数据时,我得到“内存溢出错误”。这是代码:

.data

array: .space 'A','B','C','D','E','F','G','H','I'

.text

 main:
 .
 .
 .

 la $t0,array

# $t1 is intialized to 0 and then incremented in code later for next loading
add $s4,$t1,$t0

 lb $a0,0($s4) # Here is error "Memory out of bound"

 li $v0,4

 syscall

我该如何解决这个问题?我正在使用 QTSimp

问候

4

1 回答 1

1

.space reserves empty space, without data in it. You should use:

.asciiz "ABCDEFGHI"
于 2012-10-15T22:11:19.617 回答