mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add macro arguments &foo $foo #foo.
C ABI compatibility aarch64, win64, x86, x64 Added debug info
This commit is contained in:
committed by
Christoffer Lerno
parent
4222f2731e
commit
3c15e495dd
42
test/test_suite/pointers/pointer_index.c3t
Normal file
42
test/test_suite/pointers/pointer_index.c3t
Normal file
@@ -0,0 +1,42 @@
|
||||
module foo;
|
||||
|
||||
public func void test1(int* x)
|
||||
{
|
||||
int a = x[0];
|
||||
int b = *x;
|
||||
int c = x[1];
|
||||
int d = x[-1];
|
||||
}
|
||||
|
||||
public func void test2(byte* x)
|
||||
{
|
||||
byte a = x[0];
|
||||
byte b = *x;
|
||||
byte c = x[1];
|
||||
}
|
||||
|
||||
public func void test3(long* x)
|
||||
{
|
||||
long a = x[0];
|
||||
long b = *x;
|
||||
long c = x[1];
|
||||
}
|
||||
|
||||
// #expect: pointer_index.ll
|
||||
|
||||
%x = alloca i64*, align 8
|
||||
%a = alloca i64, align 8
|
||||
%b = alloca i64, align 8
|
||||
%c = alloca i64, align 8
|
||||
store i64* %0, i64** %x
|
||||
%1 = load i64*, i64** %x, align 8
|
||||
%ptridx = getelementptr inbounds i64, i64* %1, i64 0
|
||||
%2 = load i64, i64* %ptridx, align 8
|
||||
store i64 %2, i64* %a, align 8
|
||||
%3 = load i64*, i64** %x, align 8
|
||||
%4 = load i64, i64* %3, align 8
|
||||
store i64 %4, i64* %b, align 8
|
||||
%5 = load i64*, i64** %x, align 8
|
||||
%ptridx1 = getelementptr inbounds i64, i64* %5, i64 1
|
||||
%6 = load i64, i64* %ptridx1, align 8
|
||||
store i64 %6, i64* %c, align 8
|
||||
Reference in New Issue
Block a user