| ... | ... | @@ -362,8 +362,10 @@ TypeTableEntry *get_pointer_to_type_extra(CodeGen *g, TypeTableEntry *child_type |
| 362 | 362 | } else { |
| 363 | 363 | assert(bit_offset == 0); |
| 364 | 364 | parent_pointer = &child_type->pointer_parent[(is_const ? 1 : 0)]; |
| 365 | | if (*parent_pointer) |
| 365 | if (*parent_pointer) { |
| 366 | assert((*parent_pointer)->data.pointer.alignment == byte_alignment); |
| 366 | 367 | return *parent_pointer; |
| 368 | } |
| 367 | 369 | } |
| 368 | 370 | |
| 369 | 371 | type_ensure_zero_bits_known(g, child_type); |
| ... | ... | @@ -2356,6 +2358,7 @@ static void resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) { |
| 2356 | 2358 | bool create_enum_type = decl_node->data.container_decl.auto_enum || (enum_type_node == nullptr && want_safety); |
| 2357 | 2359 | bool *covered_enum_fields; |
| 2358 | 2360 | ZigLLVMDIEnumerator **di_enumerators; |
| 2361 | uint32_t abi_alignment_so_far; |
| 2359 | 2362 | if (create_enum_type) { |
| 2360 | 2363 | occupied_tag_values.init(field_count); |
| 2361 | 2364 | |
| ... | ... | @@ -2377,7 +2380,7 @@ static void resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) { |
| 2377 | 2380 | } else { |
| 2378 | 2381 | tag_int_type = get_smallest_unsigned_int_type(g, field_count - 1); |
| 2379 | 2382 | } |
| 2380 | | union_type->data.unionation.abi_alignment = get_abi_alignment(g, tag_int_type); |
| 2383 | abi_alignment_so_far = get_abi_alignment(g, tag_int_type); |
| 2381 | 2384 | |
| 2382 | 2385 | tag_type = new_type_table_entry(TypeTableEntryIdEnum); |
| 2383 | 2386 | buf_resize(&tag_type->name, 0); |
| ... | ... | @@ -2408,9 +2411,10 @@ static void resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) { |
| 2408 | 2411 | } |
| 2409 | 2412 | tag_type = enum_type; |
| 2410 | 2413 | covered_enum_fields = allocate<bool>(enum_type->data.enumeration.src_field_count); |
| 2411 | | union_type->data.unionation.abi_alignment = get_abi_alignment(g, enum_type); |
| 2414 | abi_alignment_so_far = get_abi_alignment(g, enum_type); |
| 2412 | 2415 | } else { |
| 2413 | 2416 | tag_type = nullptr; |
| 2417 | abi_alignment_so_far = 0; |
| 2414 | 2418 | } |
| 2415 | 2419 | union_type->data.unionation.tag_type = tag_type; |
| 2416 | 2420 | |
| ... | ... | @@ -2508,12 +2512,14 @@ static void resolve_union_zero_bits(CodeGen *g, TypeTableEntry *union_type) { |
| 2508 | 2512 | uint32_t field_align_bytes = get_abi_alignment(g, field_type); |
| 2509 | 2513 | if (field_align_bytes > biggest_align_bytes) { |
| 2510 | 2514 | biggest_align_bytes = field_align_bytes; |
| 2511 | | if (biggest_align_bytes > union_type->data.unionation.abi_alignment) { |
| 2512 | | union_type->data.unionation.abi_alignment = biggest_align_bytes; |
| 2515 | if (biggest_align_bytes > abi_alignment_so_far) { |
| 2516 | abi_alignment_so_far = biggest_align_bytes; |
| 2513 | 2517 | } |
| 2514 | 2518 | } |
| 2515 | 2519 | } |
| 2516 | 2520 | |
| 2521 | union_type->data.unionation.abi_alignment = abi_alignment_so_far; |
| 2522 | |
| 2517 | 2523 | if (union_type->data.unionation.is_invalid) |
| 2518 | 2524 | return; |
| 2519 | 2525 | |