Commit 08d6876d20

Jacob G-W <jacoblevgw@gmail.com>
2021-11-11 20:26:44
c codegen: fix airIsNull with pointers
1 parent 19e5663
Changed files (1)
src
codegen
src/codegen/c.zig
@@ -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`