mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Sema: avoid use of undefined value for generic fn calls
I saw some issues in Valgrind which are fixed after this commit.
This commit is contained in:
parent
a3f05b80f1
commit
f1cff4fa4a
11
src/Sema.zig
11
src/Sema.zig
@ -7026,9 +7026,14 @@ fn funcCommon(
|
||||
});
|
||||
};
|
||||
|
||||
// stage1 bug workaround
|
||||
const cc_workaround = cc orelse undefined;
|
||||
const align_workaround = alignment orelse @as(u32, undefined);
|
||||
// These locals are pulled out from the init expression below to work around
|
||||
// a stage1 compiler bug.
|
||||
// In the case of generic calling convention, or generic alignment, we use
|
||||
// default values which are only meaningful for the generic function, *not*
|
||||
// the instantiation, which can depend on comptime parameters.
|
||||
// Related proposal: https://github.com/ziglang/zig/issues/11834
|
||||
const cc_workaround = cc orelse .Unspecified;
|
||||
const align_workaround = alignment orelse 0;
|
||||
|
||||
break :fn_ty try Type.Tag.function.create(sema.arena, .{
|
||||
.param_types = param_types,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user