添加后的异常行为

问题描述

我正在为一种小型编程语言构建编译器。我偶然发现了一个令人头疼的错误。

; & nasm -f elf64 debug.asm && gcc -m64 -no-pie -o debug debug.o && ./debug
    bits 64
    global main
    extern printf

    section .text
main:
    push rbp
    xor ebx,ebx
    add byte[block + ebx],10 ; [block + ebx] = 10
    
    ; [block + ebx + 1] += [block + ebx] * 7
    mov rax,[block + ebx]
    imul rax,7
    add byte[block + ebx + 1],al
    
    ; [block + ebx] = 17930??? why?!?
    
    mov rdi,fmt
    mov rsi,[block + ebx]
    call printf
    
    add ebx,1
    mov rdi,[block + ebx]
    call printf
    
    pop rbp
    mov rax,60
    xor rdi,rdi
    syscall

    section .data
block times 30000 db 0 ; array of bytes
fmt: db "%lld",10,0

当我运行上面的程序时。我注意到[block + ebx]中的值在添加后突然从10更改为17930。我不知道为什么会这样。我怀疑这是整数溢出。有任何想法吗?我该如何解决。预先感谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...