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

Incremental compilation breaks sanitizers #39611

Closed
japaric opened this issue Feb 7, 2017 · 0 comments · Fixed by #39993
Closed

Incremental compilation breaks sanitizers #39611

japaric opened this issue Feb 7, 2017 · 0 comments · Fixed by #39993
Labels
A-incr-comp Area: Incremental compilation

Comments

@japaric
Copy link
Member

japaric commented Feb 7, 2017

STR

examples/uninitialized-read.rs

use std::mem;

fn main() {
    let xs: [u8; 4] = unsafe { mem::uninitialized() };
    let y = xs[0] + xs[1];
}
$ export CARGO_INCREMENTAL=1

$ cargo run --target x86_64-unknown-linux-gnu --example uninitialized-read
   Compiling msan v0.1.0 (file:///home/japaric/rust/san/msan)
    Finished dev [unoptimized + debuginfo] target(s) in 0.38 secs
     Running `target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read`

# sanitizer doesn't kick in
$ RUSTFLAGS="-Z sanitizer=memory" cargo run --target x86_64-unknown-linux-gnu --example uninitialized-read
   Compiling msan v0.1.0 (file:///home/japaric/rust/san/msan)
    Finished dev [unoptimized + debuginfo] target(s) in 0.38 secs
     Running `target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read`
$ unset CARGO_INCREMENTAL

$ cargo clean

$ cargo run --target x86_64-unknown-linux-gnu --example uninitialized-read
   Compiling msan v0.1.0 (file:///home/japaric/rust/san/msan)
    Finished dev [unoptimized + debuginfo] target(s) in 0.37 secs
     Running `target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read`

# sanitizer works this time
$ RUSTFLAGS="-Z sanitizer=memory" cargo run --target x86_64-unknown-linux-gnu --example uninitialized-read
   Compiling msan v0.1.0 (file://PWD)
    Finished dev [unoptimized + debuginfo] target(s) in 0.37 secs
     Running `target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read`
==2346==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x564db789c7da in uninitialized_read::main::h0c073cea3836efc1 $PWD/examples/uninitialized-read.rs:5
    #1 0x564db7919446 in __rust_maybe_catch_panic ($PWD/target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read+0x87446)
    #2 0x564db7911df9 in std::rt::lang_start::h6954771f55df116b ($PWD/target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read+0x7fdf9)
    #3 0x564db789c8a9 in main ($PWD/target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read+0xa8a9)
    #4 0x7f80c46ab290 in __libc_start_main (/usr/lib/libc.so.6+0x20290)
    #5 0x564db789c4f9 in _start ($PWD/target/x86_64-unknown-linux-gnu/debug/examples/uninitialized-read+0xa4f9)

SUMMARY: MemorySanitizer: use-of-uninitialized-value $PWD/examples/uninitialized-read.rs:5 in uninitialized_read::main::h0c073cea3836efc1
Exiting

Meta

TODO Sanitizers are not yet in tree. (cf. #38699)


cc @michaelwoerister

@michaelwoerister michaelwoerister added the A-incr-comp Area: Incremental compilation label Feb 7, 2017
japaric pushed a commit to japaric/rust that referenced this issue Feb 21, 2017
eddyb added a commit to eddyb/rust that referenced this issue Feb 25, 2017
eddyb added a commit to eddyb/rust that referenced this issue Feb 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants