title: Mips address out of range Runtime Exception
body: <p>I was trying the answer from the post <a href="https://stackoverflow.com/questions/4881233/2d-array-in-mips">2D Array in MIPS</a> , which provides a complete coded solution for Row major matrix as user input.</p>
  
  <pre><code>    .data
  read_row_matrix_prompt_p:   .asciiz "Enter an integer: "
  ###########################################################
  
  .text
  read_row_matrix:
          li $t3, 0               # initialize outer-loop counter to 0
      li $t2, 3
      li $t1, 3
  read_row_matrix_loop_outer:
          bge $t3, $t1, read_row_matrix_loop_outer_end
          li $t4, 0               # initialize inner-loop counter to 0
  
  read_row_matrix_loop_inner:
          bge $t4, $t2, read_row_matrix_loop_inner_end
          mul $t5, $t3, $t2       # $t5 &lt;-- width * i
          add $t5, $t5, $t4       # $t5 &lt;-- width * i + j
      sll $t5, $t5, 2         # $t5 &lt;-- 2^2 * (width * i + j)
          add $t5, $t0, $t5       # $t5 &lt;-- base address + (2^2 * (width * i + j))
  
          li $v0, 4               # prompt for number
          la $a0, read_row_matrix_prompt_p
          syscall
  
          li $v0, 5               # read a integer number
          syscall
  
          sw $v0, 0($t5)          # store input number into array &lt;--- ""Error""
          addiu $t4, $t4, 1       # increment inner-loop counter
          b read_row_matrix_loop_inner    # branch unconditionally back to beginning of the inner loop
  
  read_row_matrix_loop_inner_end:
          addiu $t3, $t3, 1       # increment outer-loop counter
          b read_row_matrix_loop_outer    # branch unconditionally back to beginning of the outer loop
  
  read_row_matrix_loop_outer_end:
  </code></pre>
  
  <p>and I have run into the following error :</p>
  
  <pre><code> line 28: Runtime exception at 0x00400048: address out of range 0x00000000
  </code></pre>
  
  <p>Similar error has been posted in many questions, but each scenario seems to be local. </p>
  
  <p>I realize that #t5 would actually start from $t0 to begin with, since all the initialization make it Zero. I tried to start with <strong>1</strong> as well for the counters and still faced the same Error.</p>
  
  <p>What could be the issue here?</p>