mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
20 lines
675 B
Plaintext
20 lines
675 B
Plaintext
// #target: macos-aarch64
|
|
module other_module;
|
|
int[] list_of_ints = { 1, 2, 3 };
|
|
int* ref_to_2nd = &list_of_ints[^1];
|
|
|
|
module somemain;
|
|
import other_module, std;
|
|
fn void main() => @pool()
|
|
{
|
|
io::printfn("ptr %p", other_module::ref_to_2nd);
|
|
*other_module::ref_to_2nd = 42;
|
|
io::printfn("%s", other_module::list_of_ints);
|
|
}
|
|
|
|
/* #expect: other_module.ll
|
|
|
|
@.__const_slice = private unnamed_addr global [3 x i32] [i32 1, i32 2, i32 3], align 4
|
|
@other_module.list_of_ints = local_unnamed_addr global %"int[]" { ptr @.__const_slice, i64 3 }, align 8
|
|
@other_module.ref_to_2nd = local_unnamed_addr global ptr getelementptr inbounds (i8, ptr @.__const_slice, i64 8), align 8
|