gcc/testsuite/rust/execute/torture/issue-2187.rs
raw| 1 | /* { dg-output "L1\r*\n\L2\r*\nL3\r*\nL4" } */ |
| 2 | extern "C" { |
| 3 | fn printf(s: *const i8, ...); |
| 4 | } |
| 5 | |
| 6 | fn main() -> i32 { |
| 7 | let A = b"L1 |
| 8 | L2\0"; |
| 9 | let B = "L3 |
| 10 | L4\0"; |
| 11 | |
| 12 | unsafe { |
| 13 | let a = "%s\n\0"; |
| 14 | let b = a as *const str; |
| 15 | let c = b as *const i8; |
| 16 | |
| 17 | printf(c, A); |
| 18 | printf(c, B); |
| 19 | } |
| 20 | |
| 21 | 0 |
| 22 | } |