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

Segmentation Fault when calling a function within a call to printf #2

Open
dylanjtuttle opened this issue Sep 28, 2022 · 0 comments
Open
Labels
bug Something isn't working code gen Issue regarding the code generation stage of compilation

Comments

@dylanjtuttle
Copy link
Owner

dylanjtuttle commented Sep 28, 2022

When calling a function within a call to printf, we get a segmentation fault during the running of the generated assembly.

Minimum reproducible example:

func main() returns void {
    printf("{}", return1());
}

func return1() returns int {
    return 1;
}

This is likely caused by the stack frames created and destroyed over the course of a subroutine messing with the stack offsets of the arguments being passed into printf, which are extremely finicky.

@dylanjtuttle dylanjtuttle added bug Something isn't working code gen Issue regarding the code generation stage of compilation labels Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code gen Issue regarding the code generation stage of compilation
Projects
None yet
Development

No branches or pull requests

1 participant