| author | |
| committer | |
| log | 0ff396c34f93b60a000e1ee50e881a8c25122b79 |
| tree | 6d135970e8f427cc43dc438a5b9b96a967c43264 |
| parent | 4d8a6f6fea1b6922e7904b33c5b575249213fe53 |
2 files changed, 15 insertions(+), 0 deletions(-)
src/ir.cpp+6| ... | ... | @@ -20860,6 +20860,12 @@ static IrInstruction *ir_analyze_instruction_fence(IrAnalyze *ira, IrInstruction |
| 20860 | 20860 | if (!ir_resolve_atomic_order(ira, order_value, &order)) |
| 20861 | 20861 | return ira->codegen->invalid_instruction; |
| 20862 | 20862 | |
| 20863 | if (order < AtomicOrderAcquire) { | |
| 20864 | ir_add_error(ira, order_value, | |
| 20865 | buf_sprintf("atomic ordering must be Acquire or stricter")); | |
| 20866 | return ira->codegen->invalid_instruction; | |
| 20867 | } | |
| 20868 | ||
| 20863 | 20869 | IrInstruction *result = ir_build_fence(&ira->new_irb, |
| 20864 | 20870 | instruction->base.scope, instruction->base.source_node, order_value, order); |
| 20865 | 20871 | result->value.type = ira->codegen->builtin_types.entry_void; |
test/compile_errors.zig+9| ... | ... | @@ -14,6 +14,15 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 14 | 14 | "tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'", |
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | cases.add( | |
| 18 | "atomic orderings of fence Acquire or stricter", | |
| 19 | \\export fn entry() void { | |
| 20 | \\ @fence(.Monotonic); | |
| 21 | \\} | |
| 22 | , | |
| 23 | "tmp.zig:2:12: error: atomic ordering must be Acquire or stricter", | |
| 24 | ); | |
| 25 | ||
| 17 | 26 | cases.add( |
| 18 | 27 | "bad alignment in implicit cast from array pointer to slice", |
| 19 | 28 | \\export fn a() void { |