Commit 556f22a751

Andrew Kelley <superjoe30@gmail.com>
2018-02-28 06:28:26
different way of fixing previous commit
get_fn_type doesn't need the complete parameter type, it can just ensure zero bits known.
1 parent 1b8a241
Changed files (1)
src/analyze.cpp
@@ -997,7 +997,7 @@ TypeTableEntry *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
             gen_param_info->src_index = i;
             gen_param_info->gen_index = SIZE_MAX;
 
-            ensure_complete_type(g, type_entry);
+            type_ensure_zero_bits_known(g, type_entry);
             if (type_has_bits(type_entry)) {
                 TypeTableEntry *gen_type;
                 if (handle_is_ptr(type_entry)) {
@@ -1670,9 +1670,6 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
     if (struct_type->data.structure.is_invalid)
         return;
 
-    if (struct_type->data.structure.zero_bits_loop_flag)
-      return;
-
     AstNode *decl_node = struct_type->data.structure.decl_node;
 
     if (struct_type->data.structure.embedded_in_current) {
@@ -1685,6 +1682,7 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) {
         return;
     }
 
+    assert(!struct_type->data.structure.zero_bits_loop_flag);
     assert(struct_type->data.structure.fields);
     assert(decl_node->type == NodeTypeContainerDecl);
 
@@ -2131,6 +2129,7 @@ static void resolve_enum_zero_bits(CodeGen *g, TypeTableEntry *enum_type) {
 
     if (enum_type->data.enumeration.zero_bits_loop_flag) {
         enum_type->data.enumeration.zero_bits_known = true;
+        enum_type->data.enumeration.zero_bits_loop_flag = false;
         return;
     }
 
@@ -2285,6 +2284,7 @@ static void resolve_struct_zero_bits(CodeGen *g, TypeTableEntry *struct_type) {
         // the alignment is pointer width, then assert that the first field is within that
         // alignment
         struct_type->data.structure.zero_bits_known = true;
+        struct_type->data.structure.zero_bits_loop_flag = false;
         if (struct_type->data.structure.abi_alignment == 0) {
             if (struct_type->data.structure.layout == ContainerLayoutPacked) {
                 struct_type->data.structure.abi_alignment = 1;