aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoramp-59 <114923809+amp-59@users.noreply.github.com>2024-01-03 07:34:24 +0000
committerGitHub <noreply@github.com>2024-01-03 02:34:24 -0500
commitca4ee9ae73559062da24937ef4a7376d9d27bbeb (patch)
tree6ce300088901bac66f7bdbc10328369bb5d366f5 /test
parent60958d135f74662e2c7d4a7f80c582a647fa07b6 (diff)
downloadzig-ca4ee9ae73559062da24937ef4a7376d9d27bbeb.tar.gz
zig-ca4ee9ae73559062da24937ef4a7376d9d27bbeb.zip
Sema: Added logic to avoid unchecked operations calling `preparePanicId` (#18416)
Fixes #18415
Diffstat (limited to 'test')
-rw-r--r--test/cases/no_compile_panic_for_unchecked_arith.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/cases/no_compile_panic_for_unchecked_arith.zig b/test/cases/no_compile_panic_for_unchecked_arith.zig
new file mode 100644
index 0000000000..a9aa8272b1
--- /dev/null
+++ b/test/cases/no_compile_panic_for_unchecked_arith.zig
@@ -0,0 +1,16 @@
+pub const panic = @compileError("");
+
+export fn entry() usize {
+ var x: usize = 0;
+ x +%= 1;
+ x -%= 1;
+ x *%= 2;
+ x +|= 1;
+ x -|= 1;
+ x *|= 2;
+ return x;
+}
+
+// compile
+// output_mode=Obj
+// backend=stage2,llvm