mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Miscompilation: global struct with vector could generate an incorrect initializer.
This commit is contained in:
22
test/test_suite/vector/const_init_struct_with_vector.c3t
Normal file
22
test/test_suite/vector/const_init_struct_with_vector.c3t
Normal file
@@ -0,0 +1,22 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
struct Struct
|
||||
{
|
||||
float[<3>] foo;
|
||||
int bar;
|
||||
}
|
||||
|
||||
Struct my_struct1 = { .foo[1] = 1.0, .bar = 10 };
|
||||
Struct my_struct2 = { .bar = 10 };
|
||||
|
||||
fn int main()
|
||||
{
|
||||
return my_struct1.bar + my_struct2.bar;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
|
||||
|
||||
@test.my_struct1 = local_unnamed_addr global { [3 x float], i32 } { [3 x float] [float 0.000000e+00, float 1.000000e+00, float 0.000000e+00], i32 10 }, align 4
|
||||
@test.my_struct2 = local_unnamed_addr global { [3 x float], i32 } { [3 x float] zeroinitializer, i32 10 }, align 4
|
||||
Reference in New Issue
Block a user