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

No compile error, if you forget return #3

Closed
Akuli opened this issue Dec 29, 2022 · 2 comments · Fixed by #7, #28 or #720
Closed

No compile error, if you forget return #3

Akuli opened this issue Dec 29, 2022 · 2 comments · Fixed by #7, #28 or #720
Labels
errors and warnings Jou compiler error and warning messages

Comments

@Akuli
Copy link
Owner

Akuli commented Dec 29, 2022

cdecl puts(string: byte*) -> int

def main() -> int:
    puts("Hello World")
    # No return statement. Should not compile, but currently segfaults at runtime.

I wonder if I should ask LLVM whether the end of the function can be reached without a return statement, or should I check for that myself.

@Akuli Akuli mentioned this issue Dec 30, 2022
@Akuli Akuli closed this as completed in #7 Dec 30, 2022
@Akuli Akuli reopened this Dec 30, 2022
@Akuli
Copy link
Owner Author

Akuli commented Jan 1, 2023

The situation is now a bit different. There is an error, but it's a not-user-friendly LLVM error:

akuli@Akuli-ThinkPad:~/jou$ ./jou asd.jou
Function return type does not match operand type of return inst!
  ret void
 i32LLVM ERROR: Broken module found, compilation aborted!
Aborted

@Akuli
Copy link
Owner Author

Akuli commented Jan 20, 2025

Amusingly, this very old issue needs to be reopened again :D See #566.

@Akuli Akuli reopened this Jan 20, 2025
@Akuli Akuli added the errors and warnings Jou compiler error and warning messages label Jan 20, 2025
@Akuli Akuli closed this as completed in #720 Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors and warnings Jou compiler error and warning messages
Projects
None yet
1 participant