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

CodeGen: fix crash when using allocations in global initializer #181

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

Hyxogen
Copy link
Contributor

@Hyxogen Hyxogen commented Nov 17, 2023

Previously, EmitCheerpBuiltinExpr would assume that CurDeclFunc would never be null, which isn't the when it is a global, causing dyn_cast to trigger an assert. The same was true for calloc and realloc.

Previously, EmitCheerpBuiltinExpr would assume that CurDeclFunc would
never be null, which isn't the when it is a global, causing dyn_cast to
trigger an assert. The same was true for calloc and realloc.
@Hyxogen Hyxogen requested a review from yuri91 November 17, 2023 11:55
@Hyxogen
Copy link
Contributor Author

Hyxogen commented Nov 17, 2023

Still running my asan tests, will mark for review when those pass

When compiling for target cheerp, there's an error for when not
explicitly casting the return type of an allocation. However code
execution relying on the explicit cast AST Node still continues after
the diagnostic is reported, resulting in a nullptr deref.
@Hyxogen Hyxogen requested a review from yuri91 November 17, 2023 12:11
@Hyxogen Hyxogen marked this pull request as ready for review November 17, 2023 13:53
@yuri91 yuri91 merged commit 0ec68cc into master Nov 17, 2023
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