aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/issue-2187.rs
blob: 08246deba7fa9413f8761092a93076f64f2cbcdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-output "L1\r*\n\L2\r*\nL3\r*\nL4" } */
extern "C" {
    fn printf(s: *const i8, ...);
}

fn main() -> i32 {
    let A = b"L1
L2\0";
    let B = "L3
L4\0";

    unsafe {
        let a = "%s\n\0";
        let b = a as *const str;
        let c = b as *const i8;

        printf(c, A);
        printf(c, B);
    }

    0
}