disable MIR opts for ZST-related tests

This commit is contained in:
Ralf Jung 2021-03-25 12:44:30 +01:00
parent 726495f489
commit 585e51aabd
8 changed files with 22 additions and 2 deletions

View file

@ -1,5 +1,6 @@
// Make sure we find these even with many checks disabled.
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0 -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
fn main() {
let p = {

View file

@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0
fn main() {
// This pointer *could* be NULL so we cannot load from it, not even at ZST
let ptr = (&0u8 as *const u8).wrapping_sub(0x800) as *const ();

View file

@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0
fn main() {
// This pointer *could* be NULL so we cannot load from it, not even at ZST.
// Not using the () type here, as writes of that type do not even have MIR generated.

View file

@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0
fn main() {
let x: () = unsafe { *std::ptr::null() }; //~ ERROR memory access failed: 0x0 is not a valid pointer
panic!("this should never print: {:?}", x);

View file

@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0
fn main() {
// Not using the () type here, as writes of that type do not even have MIR generated.
// Also not assigning directly as that's array initialization, not assignment.

View file

@ -1,5 +1,6 @@
// This should fail even without validation
// compile-flags: -Zmiri-disable-validation
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0 -Zmiri-disable-validation
fn main() {
for i in 0..10 { // Try many times as this might work by chance.

View file

@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0
fn main() {
// Not using the () type here, as writes of that type do not even have MIR generated.
// Also not assigning directly as that's array initialization, not assignment.

View file

@ -1,3 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0
fn main() {
// Not using the () type here, as writes of that type do not even have MIR generated.
// Also not assigning directly as that's array initialization, not assignment.