Skip to content

Commit

Permalink
analyze: tests: add minimal test with reference PDG
Browse files Browse the repository at this point in the history
  • Loading branch information
fw-immunant committed Jun 22, 2023
1 parent f206dcb commit 5556424
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions analysis/tests/minimal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "c2rust-analysis-tests-minimal"
version = "0.1.0"
authors = ["The C2Rust Development Team <c2rust@immunant.com>"]
edition = "2021"

[dependencies]
libc = "0.2"
c2rust-analysis-rt = { path = "../../runtime", optional = true, version = "0.18.0" }

[features]
miri = []
Binary file added analysis/tests/minimal/reference_pdg.bc
Binary file not shown.
15 changes: 15 additions & 0 deletions analysis/tests/minimal/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(rustc_private)]
#![feature(c_variadic)]

pub unsafe extern "C" fn testing() {
let mut x = 10i32;
let mut ptr = &mut x as *mut i32;
let ref mut fresh1 = ptr;
*fresh1 = &mut x as *mut i32;
let fresh2 = fresh1;
**fresh2 = 0;
}

fn main() {
unsafe { testing() }
}

0 comments on commit 5556424

Please sign in to comment.