-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
backend-llvmThe LLVM backend outputs an LLVM IR Module.The LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.regressionIt worked in a previous version of Zig, but stopped working.It worked in a previous version of Zig, but stopped working.
Milestone
Description
Zig Version
0.10.0-dev.4217+9d8cdb855
Steps to Reproduce
const std = @import("std");
const expect = std.testing.expect;
test {
var opt_x: ?[3]f32 = [_]f32{ 0.0 } ** 3;
const x = opt_x.?;
opt_x.?[0] = 15.0;
try expect(x[0] == 0.0);
}Requires -O ReleaseFast to trigger. Problem is that .optional_payload elides copies unconditionally for by-ref types.
Expected Behavior
Test should pass.
Actual Behavior
$ zig test test.zig -O ReleaseFast
Test [1/1] test_0... FAIL (TestUnexpectedResult)
0 passed; 0 skipped; 1 failed.
error: the following test command failed with exit code 1:
/Users/toadman667/repos/zig/zig-cache/o/cd307c2bc32e1f4fbf5988425c58e07c/testReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backend-llvmThe LLVM backend outputs an LLVM IR Module.The LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.regressionIt worked in a previous version of Zig, but stopped working.It worked in a previous version of Zig, but stopped working.