-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Memory corruption when matching on an Option of a vector slice #8498
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
Labels
A-codegen
Area: Code generation
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Comments
there must have been some heroic test-case minimization behind the scenes of this issue |
catamorphism
added a commit
to catamorphism/rust
that referenced
this issue
Aug 14, 2013
This is a workaround for rust-lang#8498
catamorphism
added a commit
to catamorphism/rust
that referenced
this issue
Aug 14, 2013
@bblum Indeed, at first I thought the problem was process spawning... it's actually the arguments to process spawning that go wrong, even before any process gets spawned! |
Modernized testcase: fn main() {
// This is ok
match &[(~5,~7)] {
ps => {
let (ref y, _) = ps[0];
println!("1. y = {}", **y);
assert!(**y == 5);
}
}
// This is not entirely ok
match Some(&[(~5,)]) {
Some(ps) => {
let (ref y,) = ps[0];
println!("2. y = {}", **y);
if **y != 5 { println("sadness"); }
}
None => ()
}
// This is not ok
match Some(&[(~5,~7)]) {
Some(ps) => {
let (ref y, ref z) = ps[0];
println!("3. y = {} z = {}", **y, **z);
assert!(**y == 5);
}
None => ()
}
} New output:
|
This appears to have been fixed, flagging as needstest. |
jfager
added a commit
to jfager/rust
that referenced
this issue
Feb 1, 2014
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Mar 24, 2022
More `transmute_undefined_repr` fixes fixes: rust-lang#8498 fixes: rust-lang#8501 fixes: rust-lang#8503 changelog: Allow `transumte_undefined_repr` between fat pointers and `(usize, usize)` changelog: Allow `transumte_undefined_repr` when one side is a union changelog: Fix `transumte_undefined_repr` on tuples with one non-zero-sized type.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-codegen
Area: Code generation
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
The output:
In the second
match
, the first print statement prints out the right answer, but reading**y
for the second time yields garbage (perhapsy
is wrongly getting moved out of here even though it's a ref binding?). The thirdmatch
just prints out garbage.The text was updated successfully, but these errors were encountered: