diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 19:55:57 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 19:55:57 -0700 |
| commit | d5c1d24964b0ee8ad37beb8e2a907e8caa645e07 (patch) | |
| tree | e7756f5ac6c7d3eb80fb9ab5845c123fbab425fa /src/Sema.zig | |
| parent | b67d1810be3234c363ee2929ffcc91083bfb0ae5 (diff) | |
| download | zig-d5c1d24964b0ee8ad37beb8e2a907e8caa645e07.tar.gz zig-d5c1d24964b0ee8ad37beb8e2a907e8caa645e07.zip | |
stage2: fix "cmpxchg with ptr" test case
* Sema: fix atomic operand checking to allow pointers.
* LLVM backend: implement pointer-like optional constants.
* LLVM backend: fix `is_non_null` and `optional_payload` instructions
to support pointer-like optionals.
* Type: introduce `isPtrAtRuntime` method.
* Type: fix `isPtrLikeOptional` to get the correct answer for allowzero
pointers and slices.
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index c163178890..19e0f41b98 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -7518,12 +7518,16 @@ fn checkAtomicOperandType( return; }, .Bool => return, // Will be treated as `u8`. - else => return sema.mod.fail( - &block.base, - ty_src, - "expected bool, integer, float, enum, or pointer type; found {}", - .{ty}, - ), + else => { + if (ty.isPtrAtRuntime()) return; + + return sema.mod.fail( + &block.base, + ty_src, + "expected bool, integer, float, enum, or pointer type; found {}", + .{ty}, + ); + }, }; const bit_count = int_ty.intInfo(target).bits; if (bit_count > max_atomic_bits) { |
