mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Regression vector ABI: npot vectors would load incorrectly from pointers and other things. #2576
33 lines
453 B
Plaintext
33 lines
453 B
Plaintext
// #target: macos-x64
|
|
|
|
module foo;
|
|
|
|
struct Bar {
|
|
int a;
|
|
}
|
|
|
|
Bar[6] bar;
|
|
|
|
fn int main()
|
|
{
|
|
test_bar(0);
|
|
return 0;
|
|
}
|
|
|
|
fn void test_bar(int idx)
|
|
{
|
|
bar[idx].a = 0;
|
|
bar[0].a = idx;
|
|
}
|
|
|
|
/* #expect: foo.ll
|
|
|
|
define void @foo.test_bar(i32 %0) #0 {
|
|
entry:
|
|
%sext = sext i32 %0 to i64
|
|
%ptroffset = getelementptr inbounds [4 x i8], ptr @foo.bar, i64 %sext
|
|
store i32 0, ptr %ptroffset, align 4
|
|
store i32 %0, ptr @foo.bar, align 16
|
|
ret void
|
|
}
|