c codegen: fix airIsNull with pointers

This commit is contained in:
Jacob G-W 2021-11-11 14:26:44 -05:00 committed by Jakub Konka
parent 19e5663869
commit 08d6876d20

View File

@ -2165,7 +2165,10 @@ fn airIsNull(
const ty = f.air.typeOf(un_op);
var opt_buf: Type.Payload.ElemType = undefined;
const payload_type = ty.optionalChild(&opt_buf);
const payload_type = if (ty.zigTypeTag() == .Pointer)
ty.childType().optionalChild(&opt_buf)
else
ty.optionalChild(&opt_buf);
if (ty.isPtrLikeOptional()) {
// operand is a regular pointer, test `operand !=/== NULL`