atomics A.0c: harden guards (scalar-kind, ordering validity, align bail)
Adversarial review of A.0 found two silent-wrong defects reachable via the public atomic_load/atomic_store intrinsics (raw LLVM verifier errors, not clean sx diagnostics) + a latent alignment fallback. All fixed: - scalar-kind allowlist (call.zig): the size-only T guard admitted same-sized aggregates ([8]u8, 8-byte structs) -> invalid 'load atomic [8 x i8]'. Now an allowlist switch (integer/float/bool/pointer/enum/vector) rejects loudly. - per-op ordering validity (call.zig): load cannot release/acq_rel, store cannot acquire/acq_rel -> loud diagnostic instead of invalid LLVM. - val_ty align fallback (ops.zig): the 'else .i64' (align 8) default would over-align a sub-8 store -> now bails loudly on a missing val_ty. Locked by examples 1130 (non-scalar) + 1131 (bad ordering). Suite green (713/0).
This commit is contained in:
9
examples/1131-diagnostics-atomic-bad-ordering.sx
Normal file
9
examples/1131-diagnostics-atomic-bad-ordering.sx
Normal file
@@ -0,0 +1,9 @@
|
||||
// An atomic load with an ordering LLVM forbids (.release / .acq_rel) is
|
||||
// rejected with a clean diagnostic. Stream A (atomics) guard.
|
||||
#import "modules/std.sx";
|
||||
#import "modules/std/atomic.sx";
|
||||
|
||||
main :: () {
|
||||
n : i64 = 0;
|
||||
x := atomic_load(i64, @n, .release);
|
||||
}
|
||||
Reference in New Issue
Block a user