commit 0777e98bfe89eadeaa0e34a2ad07cf61cdf5b26a (tree)
parent a3b3ac0ea482fc76684ee7d0a9b98306ebbd942c
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date: Thu, 1 Jun 2023 01:44:39 -0400
Sema: disable repeated aggregate storage use with mismatching sentinel
The InternPool implementation was not written to support this, but
that could be changed and this check removed in the future.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Sema.zig b/src/Sema.zig
@@ -13094,7 +13094,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const val = v: {
// Optimization for the common pattern of a single element repeated N times, such
// as zero-filling a byte array.
- if (lhs_len == 1) {
+ if (lhs_len == 1 and lhs_info.sentinel == null) {
const elem_val = try lhs_sub_val.elemValue(mod, 0);
break :v try mod.intern(.{ .aggregate = .{
.ty = result_ty.toIntern(),