-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Yul: NoOutputAssembly assigns functions instead of appending #16127
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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, so this should in theory never do anything, as
reserve
will only perform a reallocation if and only ifcapacity()
is smaller than the new requested capacity.size()
should thus technically always be smaller or equal tocapacity()
, as auto reallocation (i.e. capacity increase) is only performed when you want to insert an element that would exceed the container's capacity.What I'm trying to say is that ASAN was likely wrong here, but this then begs another question - the old implementation appends builtin handles to
m_functions
, whereas the new one overwrites the current ones (which is good and correct) - but then, how come this wasn't caught in any tests? Do we even have tests for no output builtins?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.
The issue was with
emplace_back
down below. This is indeed a no-op so I removed it as well. We are looping overm_functions
and were simultaneously appending to 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.
Yeah, that part I understand - we had bugs like these before, which are usually quite insidious and can't be reproduced via tests quite well; my question was more so aimed at the semantic difference between the two (assume iterator invalidation is not an issue) - old implementation appends, where as the new one overwrites - this should in theory mean that in the old case
m_functions
will always have more elements than in the new (overwritten) version?In any case, it's used in the compatibility checker, so no big deal, but still weird that it wasn't caught by some test. Although from what I can see, we have no such tests, so this makes perfect sense :)
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.
Yeah the
m_functions
is populated in the superclass and has to be same in size as the one in theNoOutputDialect
that inherits from it. Appending was just wrong but not wrong enough apparently to warrant an outright crash. Semantic difference is that the the compilability checker and stack compressors would have taken the actual builtins, not the ones that are nulled out / stubbed.