| ... | @@ -835,6 +835,7 @@ pub const DeclGen = struct { | ... | @@ -835,6 +835,7 @@ pub const DeclGen = struct { |
| 835 | var buffer: Type.Payload.Bits = undefined; | 835 | var buffer: Type.Payload.Bits = undefined; |
| 836 | const int_ty = t.intTagType(&buffer); | 836 | const int_ty = t.intTagType(&buffer); |
| 837 | const bit_count = int_ty.intInfo(target).bits; | 837 | const bit_count = int_ty.intInfo(target).bits; |
| | 838 | assert(bit_count != 0); |
| 838 | return dg.context.intType(bit_count); | 839 | return dg.context.intType(bit_count); |
| 839 | }, | 840 | }, |
| 840 | .Float => switch (t.floatBits(target)) { | 841 | .Float => switch (t.floatBits(target)) { |
| ... | @@ -1077,10 +1078,10 @@ pub const DeclGen = struct { | ... | @@ -1077,10 +1078,10 @@ pub const DeclGen = struct { |
| 1077 | | 1078 | |
| 1078 | const union_obj = t.cast(Type.Payload.Union).?.data; | 1079 | const union_obj = t.cast(Type.Payload.Union).?.data; |
| 1079 | if (t.unionTagType()) |enum_tag_ty| { | 1080 | if (t.unionTagType()) |enum_tag_ty| { |
| 1080 | const enum_tag_llvm_ty = try dg.llvmType(enum_tag_ty); | | |
| 1081 | const layout = union_obj.getLayout(target, true); | 1081 | const layout = union_obj.getLayout(target, true); |
| 1082 | | 1082 | |
| 1083 | if (layout.payload_size == 0) { | 1083 | if (layout.payload_size == 0) { |
| | 1084 | const enum_tag_llvm_ty = try dg.llvmType(enum_tag_ty); |
| 1084 | gop.value_ptr.* = enum_tag_llvm_ty; | 1085 | gop.value_ptr.* = enum_tag_llvm_ty; |
| 1085 | return enum_tag_llvm_ty; | 1086 | return enum_tag_llvm_ty; |
| 1086 | } | 1087 | } |
| ... | @@ -1111,6 +1112,7 @@ pub const DeclGen = struct { | ... | @@ -1111,6 +1112,7 @@ pub const DeclGen = struct { |
| 1111 | llvm_union_ty.structSetBody(&llvm_fields, llvm_fields.len, .False); | 1112 | llvm_union_ty.structSetBody(&llvm_fields, llvm_fields.len, .False); |
| 1112 | return llvm_union_ty; | 1113 | return llvm_union_ty; |
| 1113 | } | 1114 | } |
| | 1115 | const enum_tag_llvm_ty = try dg.llvmType(enum_tag_ty); |
| 1114 | | 1116 | |
| 1115 | // Put the tag before or after the payload depending on which one's | 1117 | // Put the tag before or after the payload depending on which one's |
| 1116 | // alignment is greater. | 1118 | // alignment is greater. |