I'm getting this error when I try to run my assembly code that uses a loop
command:
"rip.s:190: Error: value of -288 too large for field of 1 bytes at 497".
This error occurs right when the program is supposed to loop. I tried initially putting "3" in the %ecx register before it enters the loop but I still get the same error. I'm not sure why this is happening so I don't really know how to go about fixing it. I've attached the pertinent code below:
//Other code
movl %ecx, -20(%ebp)
movl $0, %ecx
addl $3, %ecx
.L24:
xorl %edi, %edi
movl -32(%ebp), %ebx
movl -44(%ebp), %esi
cmpl %esi, -52(%ebp)
movl %ebx, -48(%ebp)
jg .L11
movl -52(%ebp), %eax
movl %ebx, %edx
xorl %edi, %edi
subl $2, %edx
movl %edx, -40(%ebp)
movl %eax, -36(%ebp)
.p2align 4,,7
.p2align 3
.L19:
movl -36(%ebp), %eax
testl %eax, %eax
js .L42
movl 16(%ebp), %ebx
cmpl %ebx, -36(%ebp)
je .L11
.L13:
movl -40(%ebp), %ebx
cmpl %ebx, -32(%ebp)
jl .L14
movl -36(%ebp), %esi
addl 16(%ebp), %esi
movl %edi, -60(%ebp)
movl %esi, -28(%ebp)
jmp .L31
.p2align 4,,7
.p2align 3
.L15:
movl %edx, -24(%ebp)
movl -20(%ebp), %edx
cmpl %edx, %ebx
movl %edx, -20(%ebx)
movl -24(%ebp), %edx
je .L38
.L16:
movl -28(%ebp), %edx
movl 8(%ebp), %edi
movl %edx, %eax
sarl $31, %edx
idivl 16(%ebp)
movl %edx, %esi
movl %eax, -24(%ebp)
movl -20(%ebp), %eax
leal (%ebx,%eax), %edx
movl %eax, -20(%ebp)
movl %edx, %eax
sarl $31, %edx
idivl -20(%ebp)
movl (%edi,%esi,4), %eax
cmpl $1, (%eax,%edx,4)
sbbl $-1, -60(%ebp)
addl $1, %ebx
cmpl -32(%ebp), %ebx
jg .L38
.L31:
testl %ebx, %ebx
jns .L15
addl $1, %ebx
jmp .L16
.p2align 4,,7
.p2align 3
.L38:
movl -60(%ebp), %edi
.L14:
addl $1, -36(%ebp)
movl -44(%ebp), %eax
cmpl %eax, -36(%ebp)
jle .L19
.L11:
movl -44(%ebp), %ebx
movl 8(%ebp), %esi
movl -32(%ebp), %edx
movl -4(%esi,%ebx,4), %eax
addl $1073741823, %edx
movl -56(%ebp), %esi
movl (%eax,%edx,4), %eax
movl -4(%esi,%ebx,4), %ebx
cmpl $1, %eax
adcl $-1, %edi
cmpl $3, %edi
movl %eax, -28(%ebp)
movl $1, %eax
je .L22
xorb %al, %al
cmpl $2, %edi
je .L43
.L22:
addl $1, -32(%ebp)
movl %ebx, -24(%ebp)
movl -20(%ebp), %ebx
cmpl -48(%ebp), %ebx
movl %ebx, -20(%ebp)
movl -24(%ebp), %ebx
movl %eax, (%ebx,%edx,4)
loop .L24 <--Error occurs right here
.L9:
addl $1, -44(%ebp)
jmp .L8
What is causing the error?