-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Sol2Yul] Fixed an ICE on struct member copy #12579
Conversation
aa99de4
to
c3c5aac
Compare
c881e8f
to
a82eef9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly needs a changelog entry.
@ekpyron Does it need a changelog entry? It's a change in Yul. |
Yes, but those have been added to the changelog for a while now. |
So, can you add the entry ;-)? |
e485450
to
b324ccc
Compare
b324ccc
to
32ed69c
Compare
Changelog.md
Outdated
@@ -17,6 +17,7 @@ Bugfixes: | |||
* Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis. | |||
* Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables. | |||
* IR Generator: Fix IR syntax error when copying storage arrays of structs containing functions. | |||
* IR Generator: Fix IR syntax error when copying reference types in calldata and storage to struct members in memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not only struct members, but also array elements, isn't it?
Might actually be worth another simple test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yeah, also array members, the test test/libsolidity/semanticTests/structs/copy_from_calldata.sol
shows it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a few more tests, i.e. copying storage arrays to a memory array element, etc.... we can also consider that part of #12559, but we can also do it while we're at it...
Changelog.md
Outdated
@@ -17,6 +17,7 @@ Bugfixes: | |||
* Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis. | |||
* Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables. | |||
* IR Generator: Fix IR syntax error when copying storage arrays of structs containing functions. | |||
* IR Generator: Fix IR syntax error when copying reference types in calldata and storage to struct members in memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* IR Generator: Fix IR syntax error when copying reference types in calldata and storage to struct members in memory. | |
* IR Generator: Fix IR syntax error when copying reference types in calldata and storage to struct or array members in memory. |
@ekpyron would that work? I can commit and squash it afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Github is not rendering it properly! I'll add "or array" members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Changelog still needs to include the array part. |
@ekpyron sorry, will do this today. |
Still missing the changelog entry change ;-). |
32ed69c
to
7802a6b
Compare
@@ -0,0 +1,96 @@ | |||
pragma abicoder v2; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this example: @ekpyron
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this one surprisingly also compiles in other versions. So independent of the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... I'm pretty sure that there were cases that didn't work in other versions... let me see...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contract C {
uint256[] x;
function f() public {
uint256[][] memory y = new uint256[][](1);
y[0] = x;
}
}
crashes on 0.8.11 with --experimental-via-ir --bin
for me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this test case you added also does, so it's fine - but it's not independent of the fix :-).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad. Forgot to add --ir
flag to the test. So yeah, it does crash!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change and test look good, the changelog entry is still not really accurate, but I'm already approving.
Changelog.md
Outdated
@@ -17,6 +17,7 @@ Bugfixes: | |||
* Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis. | |||
* Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables. | |||
* IR Generator: Fix IR syntax error when copying storage arrays of structs containing functions. | |||
* IR Generator: Fix IR syntax error when copying reference types in calldata and storage to struct or array members in memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it wasn't really an IR syntax error, but a failing assertion, resp. it was unimplemented so far...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing this now.
7802a6b
to
083090b
Compare
Changelog.md
Outdated
@@ -17,6 +17,7 @@ Bugfixes: | |||
* Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis. | |||
* Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables. | |||
* IR Generator: Fix IR syntax error when copying storage arrays of structs containing functions. | |||
* IR Generator: Fix ICE when copying reference types in calldata and storage to struct or array members in memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ekpyron Changed to ICE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, now it isn't sorted alphabetically anymore ;-D.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
083090b
to
0e27752
Compare
It has a merge conflict now and something weird happened to CI (but looks like a weird CirecleCI issue independent of the PR) - so I'd hope a rebase will fix it... |
This comment has been minimized.
This comment has been minimized.
3f400d1
to
58f8e52
Compare
Rebased @ekpyron :) |
Changelog.md
Outdated
@@ -18,6 +18,7 @@ Bugfixes: | |||
* Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables. | |||
* IR Generator: Add missing cleanup during the conversion of fixed bytes types to smaller fixed bytes types. | |||
* IR Generator: Add missing cleanup for indexed event arguments of value type. | |||
* IR Generator: Fix ICE when copying reference types in calldata and storage to struct or array members in memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use ICE liberally, but the term is really difficult to understand without background and "internal error" is almost as short.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can fix this. There are liked 4 other ICEs in the same section! Will leave them untouched in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
58f8e52
to
0fe5811
Compare
Closes #12220
Closes #12558