Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
29 lines
943 B
Plaintext
29 lines
943 B
Plaintext
// `xx @<extern_global>` round-trips through a non-main helper
|
|
// function: the helper's `xx @__stdinp` cast lowers to a `bitcast`
|
|
// IR opcode that emit_llvm.zig dispatches to `LLVMBuildPtrToInt`
|
|
// (BitCast doesn't accept ptr↔int on modern LLVM with opaque
|
|
// pointers), and a `u64`-returning function correctly returns
|
|
// the address.
|
|
//
|
|
// Was issue-0037 — the helper used to emit `ret i64 undef` because
|
|
// `coerceToType` had no pointer↔integer case, so the explicit
|
|
// `xx ptr` cast produced an unchanged pointer value handed to a
|
|
// `ret i64` slot.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
__stdinp : *void extern;
|
|
|
|
stdinp_addr_via_helper :: () -> u64 {
|
|
xx @__stdinp
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
direct : u64 = xx @__stdinp;
|
|
via_helper := stdinp_addr_via_helper();
|
|
print("direct non-null = {}\n", direct != 0);
|
|
print("helper non-null = {}\n", via_helper != 0);
|
|
print("eq = {}\n", direct == via_helper);
|
|
0
|
|
}
|