Skip to content

C++: Fix duplicate result types #3548

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

Merged
merged 1 commit into from
May 26, 2020

Conversation

dbartol
Copy link
Contributor

@dbartol dbartol commented May 22, 2020

I hit this while working on a different change. @rdmarsh2, this might (silently) affect your work on modeling this as a variable, because the type &this is going to be glval<unknown>.

In a couple of cases, we use glval<unknown> as the result type of an instruction because we can't come up with anything better. Two examples are the result of VariableAddress[#ellipsis], and the address of the temp variable that holds the lvalue result of the conditional operator in (a ? b : c) = y. In both cases, we call getTypeForGLValue(any(UnknownType t)), but that would have multiple results because result.hasType(any(UnknownType t), true) also holds for CppFunctionGLValueType. I tightened the result type to ensure we get the right one.

In a couple of cases, we use `glval<unknown>` as the result type of an instruction because we can't come up with anything better. Two examples are the result of `VariableAddress[#ellipsis]`, and the address of the temp variable that holds the lvalue result of the conditional operator in `(a ? b : c) = y`. In both cases, we call `getTypeForGLValue(any(UnknownType t))`, but that would have multiple results because `result.hasType(any(UnknownType t), true)` also holds for `CppFunctionGLValueType`. I tightened the result type to ensure we get the right one.
@dbartol dbartol added the C++ label May 22, 2020
@dbartol dbartol requested a review from rdmarsh2 May 22, 2020 20:51
@dbartol dbartol requested a review from a team as a code owner May 22, 2020 20:51
Copy link
Contributor

@rdmarsh2 rdmarsh2 left a comment

Choose a reason for hiding this comment

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

LGTM

@rdmarsh2 rdmarsh2 merged commit 2429e22 into github:master May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants