gccrs: Add execution test cases
[official-gcc.git] / gcc / testsuite / rust / execute / torture / cfg2.rs
blob5048bcb2791d76c6e166c1eeffde663efa754b58
1 // { dg-additional-options "-w -frust-cfg=A" }
2 // { dg-output "test1\n" }
3 extern "C" {
4     fn printf(s: *const i8, ...);
7 fn test() {
8     #[cfg(A)]
9     unsafe {
10         let a = "test1\n\0";
11         let b = a as *const str;
12         let c = b as *const i8;
14         printf(c);
15     }
17     #[cfg(B)]
18     unsafe {
19         let a = "test2\n\0";
20         let b = a as *const str;
21         let c = b as *const i8;
23         printf(c);
24     }
27 fn main() -> i32 {
28     test();
30     0