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

Bind array and function-typed compound literals to temporaries #864

Merged
merged 16 commits into from
Jul 24, 2020

Conversation

kkjeer
Copy link
Contributor

@kkjeer kkjeer commented Jul 2, 2020

See #859 - this PR will fix the issue for array-typed compound literals (but not for struct-typed compound literals - that is a follow-up issue, see issue #870)

This PR introduces a temporary binding for an array-typed or function-typed CompoundLiteralExpr. This allows the bounds checker to infer lvalue bounds for an array-typed compound literal in CheckTempBindingLValue.

Issue #870 tracks the work needed to bind non-array, non-function-typed compound literals to temporaries (e.g. struct-typed compound literals).

Testing:

  • Added compound-literals.c to test inferring lvalue bounds for compound literal expressions
  • Passed manual testing on Windows
  • Passed automated testing on Windows/Linux

@kkjeer kkjeer requested review from dtarditi and mgrang July 2, 2020 01:28
Copy link

@mgrang mgrang left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Member

@dtarditi dtarditi left a comment

Choose a reason for hiding this comment

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

Looks great.

Does it make sense to add a test case to the checkedc repo to illustrate that the probem in #856 is fixed? The Checked C repo has tests for language-level behavior, while the checkedc-clang repo has tests that may expose compiler implementation details.

@kkjeer kkjeer changed the title Bind compound literals to temporaries Bind array and function-typed compound literals to temporaries Jul 8, 2020
@kkjeer kkjeer merged commit aa9fa9d into master Jul 24, 2020
@kkjeer kkjeer deleted the issue-859-address-compound-literal branch July 24, 2020 17:50
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.

3 participants