Fix evaluation order in struct field expressions#4448
Open
elshorbagyx wants to merge 4 commits intoRust-GCC:masterfrom
Open
Fix evaluation order in struct field expressions#4448elshorbagyx wants to merge 4 commits intoRust-GCC:masterfrom
elshorbagyx wants to merge 4 commits intoRust-GCC:masterfrom
Conversation
188de4d to
d1fd377
Compare
Member
|
the tests are failing: but also i am pretty sure we update the ordering within the typecheck pass to sort this out. |
Author
I am working on that. |
Collaborator
|
Make sure to double-check that the generated GIMPLE doesn't have unspecified evaluation order (I'm not sure about |
Fixes Rust-GCC#4445 gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Get struct field type with field name * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): Cancel reordering of struct field exprs Signed-off-by: Mohamed El Shorbagy <mohrizq895@gmail.com>
d1fd377 to
b4a862e
Compare
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Signed-off-by: Mohamed El Shorbagy <mohrizq895@gmail.com>
Author
|
@philberty @powerboat9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4445
gcc/rust/ChangeLog:
gccrs evaluates struct field expressions in the order they are declared inside the struct definition. The current logic reorders the struct field expressions to match the struct field types, which results in incorrect behavior compared to the Rust reference (as mentioned in #4445). Instead, we could fetch the struct field type by field name through
lookup_field.