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

Avoid overflow in GVN constant indexing. #119052

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

cjgillot
Copy link
Contributor

Fixes #118992
Fixes #119008

@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 17, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

from_end: false,
};
projection.to_mut()[i] =
ProjectionElem::ConstantIndex { offset, min_length, from_end: false };
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why ConstantIndex stores min_length instead of, e.g., the "max index" of the last value?

Copy link
Member

Choose a reason for hiding this comment

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

Well I guess it doesn't make sense to index at usize::MAX anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

min_length comes from slice match. I supposed it's easier to compute from the length of the pattern.

@cjgillot cjgillot added the A-mir-opt Area: MIR optimizations label Dec 17, 2023
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 17, 2023

📌 Commit 8022057 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 17, 2023
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#118880 (More expressions correctly are marked to end with curly braces)
 - rust-lang#118928 (fix: Overlapping spans in delimited meta-vars)
 - rust-lang#119022 (Remove unnecessary constness from ProjectionCandidate)
 - rust-lang#119052 (Avoid overflow in GVN constant indexing.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 39fe059 into rust-lang:master Dec 17, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 17, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 17, 2023
Rollup merge of rust-lang#119052 - cjgillot:gvn-index-overflow, r=compiler-errors

Avoid overflow in GVN constant indexing.

Fixes rust-lang#118992
Fixes rust-lang#119008
@cjgillot cjgillot deleted the gvn-index-overflow branch December 17, 2023 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attempt to add with overflow in GVN when building chrono-tz assertion failed: offset < min_length in GVN
5 participants