aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/cfg2.rs
blob: 7b75ac6962fa47ba50d574a509633d3758275a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// { dg-additional-options "-w -frust-cfg=A" }
// { dg-output "test1\r*\n" }
extern "C" {
    fn printf(s: *const i8, ...);
}

fn test() {
    #[cfg(A)]
    unsafe {
        let a = "test1\n\0";
        let b = a as *const str;
        let c = b as *const i8;

        printf(c);
    }

    #[cfg(B)]
    unsafe {
        let a = "test2\n\0";
        let b = a as *const str;
        let c = b as *const i8;

        printf(c);
    }
}

fn main() -> i32 {
    test();

    0
}