mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Splat 8 arguments can sometimes cause incorrect behaviour in the compiler. #2283
This commit is contained in:
33
test/test_suite/functions/splat_8.c3t
Normal file
33
test/test_suite/functions/splat_8.c3t
Normal file
@@ -0,0 +1,33 @@
|
||||
// #target: linux-aarch64
|
||||
module test;
|
||||
import std;
|
||||
macro @do_splat_thing(#args)
|
||||
{
|
||||
String[] args = { "program-name", ...(String[])#args };
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
@do_splat_thing({ "str1","str1","str1","str1","str1","str1","str3" });
|
||||
@do_splat_thing({ "str1","str1","str1","str1","str1","str1","str1","str2" });
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define i32 @main() #0 {
|
||||
entry:
|
||||
%args = alloca %"char[][]", align 8
|
||||
%literal = alloca [8 x %"char[]"], align 8
|
||||
%args1 = alloca %"char[][]", align 8
|
||||
%literal2 = alloca [9 x %"char[]"], align 8
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 128, i1 false)
|
||||
%0 = insertvalue %"char[][]" undef, ptr %literal, 0
|
||||
%1 = insertvalue %"char[][]" %0, i64 8, 1
|
||||
store %"char[][]" %1, ptr %args, align 8
|
||||
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal2, ptr align 8 @.__const.17, i32 144, i1 false)
|
||||
%2 = insertvalue %"char[][]" undef, ptr %literal2, 0
|
||||
%3 = insertvalue %"char[][]" %2, i64 9, 1
|
||||
store %"char[][]" %3, ptr %args1, align 8
|
||||
ret i32 0
|
||||
}
|
||||
Reference in New Issue
Block a user