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

Translate-c: Check for error before working on while loop body #1445

Merged
merged 3 commits into from
Aug 31, 2018

Conversation

Hejsil
Copy link
Contributor

@Hejsil Hejsil commented Aug 31, 2018

fixes #1428

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, merge at will

? trans_do_loop(c, scope, (const DoStmt *)stmt)
: trans_while_loop(c, scope, (const WhileStmt *)stmt);

if (while_node != nullptr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be clearer like this:

if (while_node == nullptr)
    return ErrorUnexpected;

@Hejsil Hejsil merged commit e036f65 into master Aug 31, 2018
@Hejsil Hejsil deleted the trans-c-check-while-error branch August 31, 2018 21:17
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.

translate-c: goto inside while loop segfault
2 participants