Open ApplePieCodes opened 2 months ago
I believe he's intentionally adding an exit at the end of a program (even if you didnt add it yourself), which would mean that this isn't a bug (and you can't really exit twice, it exists and the second one isnt executed)
I believe he's intentionally adding an exit at the end of a program (even if you didnt add it yourself), which would mean that this isn't a bug (and you can't really exit twice, it exists and the second one isnt executed)
This seems to be the case (check Line 247 of generation.hpp)
Ok. I would change it to only add an exit if there is no exit declared in the program
Ok. I would change it to only add an exit if there is no exit declared in the program
Personally I'd just leave it as is.
the code
exit(12)
produces the following ASMglobal _start _start: ;; exit mov rax, 12 push rax mov rax, 60 pop rdi syscall ;; /exit mov rax, 60 mov rdi, 0 syscall
the program exits twice.