-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Regression in beta: unsafe-free, pure Rust pgm. with no deps segfaults #36401
Comments
Minimized a bit: #[derive(Debug)]
pub enum Event {
Key(u8),
Resize,
Unknown(Vec<u8>),
}
static XTERM_SINGLE_BYTES : [(u8, Event); 1] =
[ (1, Event::Resize)
];
fn main() {
println!("{:?}", XTERM_SINGLE_BYTES);
} This incorrectly prints
|
With (Edit: I missed a nightly in the original version of this comment.) |
Thanks @TimNN, as a workaround until this is fixed I switched to nightly-2016-05-08 and it works nicely. |
The #[derive(Debug)]
pub enum Event {
Key(u8),
Resize,
Unknown(i16),
} as long as the types wrapped are of different sizes. Also, I can reproduce this only as long as the size of the integer used in the static is smaller than than the size of the larger "wrapped" integer (in this case, the wrapped integer is |
Looks like missing alignment:
|
@arielb1 where did you get this? With original test case on play.rlo has |
The |
(can be tested here: https://is.gd/EkJ3by)
When run with beta or nightly, this program segfaults.
I tried to simplify this a little bit, but my attempts either turned segfault into a stack overflow, or made it working. Here are some changes I've tried:
[(u8, char)]
forXTERM_SINGLE_BYTES
and it worked fine.Event::Key
s (e.g.[(u8, Key)]
) and it worked.Event
enum, most of the time the error turned into a stack overflow.In my original program I'm iterating the array, and for the
u8
part I'm getting random bytes instead of bytes I put in the array. I'm using rustc 1.13.0-nightly (70598e0 2016-09-03).The text was updated successfully, but these errors were encountered: