Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit Exits twice #27

Open
ApplePieCodes opened this issue Sep 5, 2024 · 4 comments
Open

Exit Exits twice #27

ApplePieCodes opened this issue Sep 5, 2024 · 4 comments

Comments

@ApplePieCodes
Copy link

the code exit(12) produces the following ASM
global _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.

@andriemc
Copy link

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)

@andriemc
Copy link

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)

@ApplePieCodes
Copy link
Author

Ok. I would change it to only add an exit if there is no exit declared in the program

@andriemc
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants