Skip to content

Commit e9d2c12

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 e9d2c12

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <stdint.h>
2+
3+
void f() {
4+
int32_t a = 0x80000000U;
5+
int32_t b = 0x80000000;
6+
int32_t c = 0x8000000000000000;
7+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 a: int32_t = 0x80000000 as int32_t;
19+
let mut b: int32_t = 0x80000000 as int32_t;
20+
let mut c: int32_t = 0x8000000000000000 as int32_t;
21+
}

0 commit comments

Comments
 (0)