Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

use std::mem::{self, MaybeUninit};

fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// The function zeroed() calls assert_zero_valid to mark that it is only defined to assign an
// all-zero bit pattern to a type T if this is a valid value. So the following is undefined.

Expand Down
2 changes: 2 additions & 0 deletions src/test/cbmc/BinOp_Offset/main_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

include!("../../rmc-prelude.rs");

pub fn test_offset_in_double_array() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

fn main() {
// Intrinsics implemented as integer primitives
// https://doc.rust-lang.org/core/intrinsics/fn.cttz.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

#![feature(core_intrinsics)]
use std::intrinsics::{ctlz, cttz, cttz_nonzero};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

// rmc-verify-fail
// cbmc-flags: --bounds-check

#![feature(core_intrinsics)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

// rmc-verify-fail
// cbmc-flags: --bounds-check

#![feature(core_intrinsics)]
Expand Down
3 changes: 2 additions & 1 deletion src/test/cbmc/DynTrait/boxed_closure_fail_fixme.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// Check that we can codegen a boxed dyn closure and fail an inner assertion

// This current verifies "successfully" because the closure is not actually
// called in the resulting CotoC code.
// called in the resulting GotoC code.
// https://github.com/model-checking/rmc/issues/240

include!("../../rmc-prelude.rs");
Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/DynTrait/boxed_trait_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// Dynamic traits should work when used through a box
// _fail test; all assertions inverted.
Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/DynTrait/different_crates_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// This test uses a trait defined in a different crate (the standard library)
// and a test defined in the local crate. The goal is to test vtable resolution
Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/DynTrait/nested_boxes_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// This test checks the size and align fields for 3-deep nested trait pointers. The
// outter 2 dynamic trait objects have fat pointers as their backing data.
Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/FatPointers/boxmuttrait_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

use std::io::{sink, Write};

Expand Down
2 changes: 1 addition & 1 deletion src/test/cbmc/FatPointers/boxslice1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ fn main() {
// This transformer produces a Box<[u8]>
let _sparkle_heart_str = str::from_utf8(&sparkle_heart_vec);

// see boxslice2_fail.rs for an attempt to test sparkle_heart_str
// see boxslice2.rs for an attempt to test sparkle_heart_str
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// Casts boxed array to boxed slice (example taken from rust documentation)
use std::str;
Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/FatPointers/boxtrait_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// This is handled by the box to box case of unsized pointers

Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/FatPointers/trait1_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// Cast a concrete ref to a trait ref.

Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/FatPointers/trait2_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// Cast a concrete ref to a trait raw pointer.

Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/FatPointers/trait3_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

// Cast a concrete ref to
// concrete raw pointer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

#![feature(core_intrinsics)]
use std::intrinsics;
fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/cbmc/PointerOffset/Unstable/main_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

#![feature(core_intrinsics)]
use std::intrinsics::ptr_offset_from;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

fn main() {
let address = 0x01234usize;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

fn main() {
// declare pointer to integer
let p_subscoped: *const u32;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

#![feature(repr_simd, platform_intrinsics)]

#[repr(simd)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-check-fail

// We currently assert(false) for reify function pointer.
// So this codegens but fails model checking.

Expand Down
1 change: 1 addition & 0 deletions src/test/cbmc/SizeAndAlignOfDst/main_fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Arc<Mutex<dyn Subscriber>>.
// This test still fails with a final coercion error for
// DummySubscriber to dyn Subscriber.
// rmc-verify-fail

use std::sync::Arc;
use std::sync::Mutex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-check-fail

#[allow(unconditional_recursion)]
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
// Code here does not matter - this is replaced by the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

use std::fs;
use std::path::PathBuf;
pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-verify-fail

use std::slice;

include!("../../rmc-prelude.rs");
Expand Down
21 changes: 21 additions & 0 deletions src/test/cbmc/VolatileIntrinsics/core_intrinsics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// rmc-codegen-fail

#![feature(core_intrinsics)]

use std::intrinsics::*;

pub fn main() {
let mut a: Box<u8> = Box::new(0);
unsafe {
let x = volatile_load(&*a);
assert!(x == *a);
volatile_store(&mut *a, 1);
assert!(*a == 1);
unaligned_volatile_store(&mut *a, 2);
assert!(*a == 2);
volatile_set_memory(&mut *a, 3, 1);
assert!(*a == 3);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

// rmc-verify-fail
// cbmc-flags: --unwind 4

use std::cmp::Ordering::*;
Expand Down Expand Up @@ -43,7 +43,7 @@ fn binary_search<T: Ord>(arr: &[T], elem: &T) -> Option<usize> {
None
}

include!("../../rmc-prelude.rs");
include!("../rmc-prelude.rs");

fn get() -> [i32; 11] {
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

pub fn main() {
let a = 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

include!("../../rmc-prelude.rs");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

pub fn main() {
let a = 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

pub fn main() {
let a = 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

pub fn main() {
let a = 2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

pub fn main() {
let a = 2;
Expand Down
1 change: 1 addition & 0 deletions src/test/smack/functions/closure_fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @flag --no-memory-splitting
// @expect verified
// rmc-verify-fail

fn call_with_one<F>(mut some_closure: F) -> ()
where
Expand Down
1 change: 1 addition & 0 deletions src/test/smack/functions/double_fail.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

fn double(a: u32) -> u32 {
a * 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

struct Point<T> {
pub x: T,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

struct Point<T> {
pub x: T,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect error
// rmc-verify-fail

struct Point<T> {
pub x: T,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect verified
// rmc-verify-fail

struct Point<T> {
pub x: T,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect verified
// rmc-verify-fail

struct Point<T> {
pub x: T,
Expand Down
1 change: 0 additions & 1 deletion src/test/smack/loops/gauss_sum_nondet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @flag --no-memory-splitting --unroll=4
// @expect verified

// cbmc-flags: --unwind 5

include!("../../rmc-prelude.rs");
Expand Down
2 changes: 1 addition & 1 deletion src/test/smack/loops/gauss_sum_nondet_fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @flag --no-memory-splitting --unroll=10
// @expect error

// rmc-verify-fail
// cbmc-flags: --unwind 5

include!("../../rmc-prelude.rs");
Expand Down
2 changes: 1 addition & 1 deletion src/test/smack/loops/iterator_fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @flag --no-memory-splitting --unroll=10
// @expect error

// rmc-verify-fail
// cbmc-flags: --unwind 5

fn fac(n: u64) -> u64 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @flag --integer-overflow
// @expect overflow
// rmc-verify-fail

pub fn get128() -> u8 {
128
Expand Down
Loading