| ... | @@ -15222,6 +15222,12 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira, | ... | @@ -15222,6 +15222,12 @@ static TypeTableEntry *ir_analyze_instruction_offset_of(IrAnalyze *ira, |
| 15222 | return ira->codegen->builtin_types.entry_invalid; | 15222 | return ira->codegen->builtin_types.entry_invalid; |
| 15223 | } | 15223 | } |
| 15224 | | 15224 | |
| | 15225 | if (field->type_entry->zero_bits) { |
| | 15226 | ir_add_error(ira, field_name_value, |
| | 15227 | buf_sprintf("zero-bit field '%s' in struct '%s' has no offset", |
| | 15228 | buf_ptr(field_name), buf_ptr(&container_type->name))); |
| | 15229 | return ira->codegen->builtin_types.entry_invalid; |
| | 15230 | } |
| 15225 | size_t byte_offset = LLVMOffsetOfElement(ira->codegen->target_data_ref, container_type->type_ref, field->gen_index); | 15231 | size_t byte_offset = LLVMOffsetOfElement(ira->codegen->target_data_ref, container_type->type_ref, field->gen_index); |
| 15226 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 15232 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 15227 | bigint_init_unsigned(&out_val->data.x_bigint, byte_offset); | 15233 | bigint_init_unsigned(&out_val->data.x_bigint, byte_offset); |