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

Special-case the type of the C main() function #99

Merged

Conversation

hikari-no-yume
Copy link
Collaborator

A fix for part of #98, as discussed there.

I hope the code is self-explanatory.

@hikari-no-yume
Copy link
Collaborator Author

Trivial example of what this change does:

; Function Attrs: norecurse nounwind readnone ssp uwtable
define i32 @main(i32 %0, i8** nocapture readnone %1) local_unnamed_addr #0 {
  ret i32 0
}
int main(int argc, char ** argv) {
  uint32_t _1 = (uint32_t)argc;
  uint8_t** _2 = (uint8_t**)argv;
  return 0;
}

Without this change, it looks like:

uint32_t main(uint32_t _1, uint8_t** _2) {
  return 0;
}

Because the argument types are wrong, GCC and Clang refuse to compile it without special flags. They also warn about the wrong return type.

@vtjnash vtjnash merged commit 1df01c2 into JuliaHubOSS:master Apr 24, 2021
@hikari-no-yume hikari-no-yume deleted the main-signature-special-case branch May 9, 2021 19:12
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

Successfully merging this pull request may close these issues.

2 participants