| 1 |
// { dg-output "hello world: gccrs\r*\n" } |
| 2 |
// { dg-additional-options "-w" } |
| 3 |
static TEST_1: &str = "gccrs"; |
| 4 |
static TEST_2: i32 = 123; |
| 5 |
|
| 6 |
struct Foo(i32, bool); |
| 7 |
static TEST_3: Foo = Foo(123, false); |
| 8 |
|
| 9 |
extern "C" { |
| 10 |
fn printf(s: *const i8, ...); |
| 11 |
} |
| 12 |
|
| 13 |
fn main() -> i32 { |
| 14 |
unsafe { |
| 15 |
let a1 = "hello world: %s\n"; |
| 16 |
let b1 = a1 as *const str; |
| 17 |
let c1 = b1 as *const i8; |
| 18 |
|
| 19 |
let a2 = TEST_1; |
| 20 |
let b2 = a2 as *const str; |
| 21 |
let c2 = b2 as *const i8; |
| 22 |
|
| 23 |
printf(c1, c2); |
| 24 |
} |
| 25 |
0 |
| 26 |
} |