mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Assert triggered when casting from int[2] to uint[2] #2115
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
## 0.7.2 Change list
|
||||
|
||||
No changes yet
|
||||
### Fixes
|
||||
- Assert triggered when casting from `int[2]` to `uint[2]` #2115
|
||||
|
||||
## 0.7.1 Change list
|
||||
|
||||
|
||||
@@ -2199,7 +2199,7 @@ static void cast_arr_to_vec(Expr *expr, Type *to_type)
|
||||
static void cast_arr_to_arr(Expr *expr, Type *to_type)
|
||||
{
|
||||
ASSERT(type_size(to_type) == type_size(expr->type));
|
||||
expr->type = to_type;
|
||||
expr_rewrite_recast(expr, to_type);
|
||||
}
|
||||
|
||||
static void cast_anyfault_to_bool(Expr *expr, Type *to_type)
|
||||
|
||||
29
test/test_suite/cast/cast_unsigned_signed_arr.c3t
Normal file
29
test/test_suite/cast/cast_unsigned_signed_arr.c3t
Normal file
@@ -0,0 +1,29 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
fn void main()
|
||||
{
|
||||
uint[2] v;
|
||||
foo(v);
|
||||
}
|
||||
|
||||
fn void foo(int[2] v) {}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define void @test.main() #0 {
|
||||
entry:
|
||||
%v = alloca [2 x i32], align 4
|
||||
store i32 0, ptr %v, align 4
|
||||
%ptradd = getelementptr inbounds i8, ptr %v, i64 4
|
||||
store i32 0, ptr %ptradd, align 4
|
||||
%0 = load i64, ptr %v, align 4
|
||||
call void @test.foo(i64 %0)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test.foo(i64 %0) #0 {
|
||||
entry:
|
||||
%v = alloca [2 x i32], align 4
|
||||
store i64 %0, ptr %v, align 4
|
||||
ret void
|
||||
}
|
||||
Reference in New Issue
Block a user