@@ -1841,6 +1841,7 @@ pub const Object = struct {
1841
1841
}
1842
1842
1843
1843
const fields = ty .structFields ();
1844
+ const layout = ty .containerLayout ();
1844
1845
1845
1846
var di_fields : std .ArrayListUnmanaged (* llvm .DIType ) = .{};
1846
1847
defer di_fields .deinit (gpa );
@@ -1854,7 +1855,7 @@ pub const Object = struct {
1854
1855
if (field .is_comptime or ! field .ty .hasRuntimeBitsIgnoreComptime ()) continue ;
1855
1856
1856
1857
const field_size = field .ty .abiSize (target );
1857
- const field_align = field .normalAlignment (target );
1858
+ const field_align = field .alignment (target , layout );
1858
1859
const field_offset = std .mem .alignForwardGeneric (u64 , offset , field_align );
1859
1860
offset = field_offset + field_size ;
1860
1861
@@ -2499,7 +2500,7 @@ pub const DeclGen = struct {
2499
2500
2500
2501
fn lowerType (dg : * DeclGen , t : Type ) Allocator.Error ! * const llvm.Type {
2501
2502
const llvm_ty = try lowerTypeInner (dg , t );
2502
- if (std .debug .runtime_safety and false ) check : {
2503
+ if (std .debug .runtime_safety ) check : {
2503
2504
if (t .zigTypeTag () == .Opaque ) break :check ;
2504
2505
if (! t .hasRuntimeBits ()) break :check ;
2505
2506
if (! llvm_ty .isSized ().toBool ()) break :check ;
@@ -2757,7 +2758,7 @@ pub const DeclGen = struct {
2757
2758
for (struct_obj .fields .values ()) | field | {
2758
2759
if (field .is_comptime or ! field .ty .hasRuntimeBitsIgnoreComptime ()) continue ;
2759
2760
2760
- const field_align = field .normalAlignment (target );
2761
+ const field_align = field .alignment (target , struct_obj . layout );
2761
2762
const field_ty_align = field .ty .abiAlignment (target );
2762
2763
any_underaligned_fields = any_underaligned_fields or
2763
2764
field_align < field_ty_align ;
@@ -3433,7 +3434,7 @@ pub const DeclGen = struct {
3433
3434
for (struct_obj .fields .values ()) | field , i | {
3434
3435
if (field .is_comptime or ! field .ty .hasRuntimeBitsIgnoreComptime ()) continue ;
3435
3436
3436
- const field_align = field .normalAlignment (target );
3437
+ const field_align = field .alignment (target , struct_obj . layout );
3437
3438
big_align = @maximum (big_align , field_align );
3438
3439
const prev_offset = offset ;
3439
3440
offset = std .mem .alignForwardGeneric (u64 , offset , field_align );
@@ -9376,13 +9377,14 @@ fn llvmFieldIndex(
9376
9377
}
9377
9378
return null ;
9378
9379
}
9379
- assert (ty .containerLayout () != .Packed );
9380
+ const layout = ty .containerLayout ();
9381
+ assert (layout != .Packed );
9380
9382
9381
9383
var llvm_field_index : c_uint = 0 ;
9382
9384
for (ty .structFields ().values ()) | field , i | {
9383
9385
if (field .is_comptime or ! field .ty .hasRuntimeBitsIgnoreComptime ()) continue ;
9384
9386
9385
- const field_align = field .normalAlignment (target );
9387
+ const field_align = field .alignment (target , layout );
9386
9388
big_align = @maximum (big_align , field_align );
9387
9389
const prev_offset = offset ;
9388
9390
offset = std .mem .alignForwardGeneric (u64 , offset , field_align );
0 commit comments