aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/issue-1231.rs
blob: 321df5fec55cc2acab6d26f41ede3a92a1e3808d (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
32
33
34
35
36
// { dg-additional-options "-w" }
// { dg-output "outer\r*\ninner\r*\n" }
extern "C" {
    fn printf(s: *const i8, ...);
}

fn machin() {
    unsafe {
        let a = "outer\n\0";
        let b = a as *const str;
        let c = b as *const i8;

        printf(c, 123);
    }
}

fn bidule() {
    fn machin() {
        unsafe {
            let a = "inner\n\0";
            let b = a as *const str;
            let c = b as *const i8;

            printf(c, 123);
        }
    }

    self::machin();
    machin();
}

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

    0
}