mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Compiler crash when using arrays of vectors in lists. #2889
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
### Fixes
|
||||
- Add error message if directory with output file name already exists
|
||||
- Regression where nested lambdas would be evaluated twice.
|
||||
- Compiler crash when using arrays of vectors in lists. #2889
|
||||
|
||||
## 0.7.9 Change list
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ void x64_classify_struct_union(Type *type, ByteSize offset_base, X64Class *curre
|
||||
void x64_classify_array(Type *type, ByteSize offset_base, X64Class *current, X64Class *lo_class, X64Class *hi_class, NamedArgument named_arg)
|
||||
{
|
||||
ByteSize size = type_size(type);
|
||||
Type *element = type_lowering(type->array.base);
|
||||
Type *element = lowered_array_element_type(type);
|
||||
ByteSize element_size = type_size(element);
|
||||
// Bigger than 64 bytes => MEM
|
||||
if (size > 64) return;
|
||||
|
||||
41
test/test_suite/abi/x64_array_of_vec_in_struct.c3t
Normal file
41
test/test_suite/abi/x64_array_of_vec_in_struct.c3t
Normal file
@@ -0,0 +1,41 @@
|
||||
// #target: linux-x64
|
||||
module test;
|
||||
import std::collections;
|
||||
|
||||
fn void main()
|
||||
{
|
||||
List{int[<2>][2]} test_list;
|
||||
test_list.tinit();
|
||||
|
||||
int[<2>][2] input;
|
||||
|
||||
input[0] = {1, 2};
|
||||
input[1] = {3, 4};
|
||||
|
||||
test_list.push(input);
|
||||
|
||||
assert(test_list.contains(input));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define void @test.main() #0 {
|
||||
entry:
|
||||
%test_list = alloca %"List{int[<2>][2]}", align 8
|
||||
%input = alloca [2 x <2 x i32>], align 16
|
||||
call void @llvm.memset.p0.i64(ptr align 8 %test_list, i8 0, i64 40, i1 false)
|
||||
%0 = call ptr @"std.collections.list.List$a2$v2$int$.tinit"(ptr %test_list, i64 16)
|
||||
store <2 x i32> zeroinitializer, ptr %input, align 16
|
||||
%ptradd = getelementptr inbounds i8, ptr %input, i64 8
|
||||
store <2 x i32> zeroinitializer, ptr %ptradd, align 8
|
||||
store <2 x i32> <i32 1, i32 2>, ptr %input, align 16
|
||||
%ptradd1 = getelementptr inbounds i8, ptr %input, i64 8
|
||||
store <2 x i32> <i32 3, i32 4>, ptr %ptradd1, align 8
|
||||
%lo = load i64, ptr %input, align 16
|
||||
%ptradd2 = getelementptr inbounds i8, ptr %input, i64 8
|
||||
%hi = load i64, ptr %ptradd2, align 8
|
||||
call void @"std.collections.list.List$a2$v2$int$.push"(ptr %test_list, i64 %lo, i64 %hi) #2
|
||||
ret void
|
||||
}
|
||||
Reference in New Issue
Block a user