Skip to content

Commit 4a4c0cc

Browse files
committed
transpile: tests: add out_of_range_int.c test for an int32_t that is 2^31
This is from `libmcs` and is currently broken.
1 parent a2c2149 commit 4a4c0cc

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdint.h>
2+
3+
void f() {
4+
int32_t sign = 0x80000000U;
5+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
source: c2rust-transpile/tests/snapshots.rs
3+
expression: cat tests/snapshots/out_of_range_int.rs
4+
input_file: c2rust-transpile/tests/snapshots/out_of_range_int.c
5+
---
6+
#![allow(
7+
dead_code,
8+
non_camel_case_types,
9+
non_snake_case,
10+
non_upper_case_globals,
11+
unused_assignments,
12+
unused_mut
13+
)]
14+
pub type __int32_t = i32;
15+
pub type int32_t = __int32_t;
16+
#[no_mangle]
17+
pub unsafe extern "C" fn f() {
18+
let mut sign: int32_t = 0x80000000 as int32_t;
19+
}

0 commit comments

Comments
 (0)