| ... | @@ -13488,6 +13488,15 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct | ... | @@ -13488,6 +13488,15 @@ static TypeTableEntry *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstruct |
| 13488 | | 13488 | |
| 13489 | TypeTableEntry *child_type = ptr->value.type->data.pointer.child_type; | 13489 | TypeTableEntry *child_type = ptr->value.type->data.pointer.child_type; |
| 13490 | | 13490 | |
| | 13491 | uint32_t align_bytes = ptr->value.type->data.pointer.alignment; |
| | 13492 | uint64_t size_bytes = type_size(ira->codegen, child_type); |
| | 13493 | if (align_bytes < size_bytes) { |
| | 13494 | ir_add_error(ira, instruction->ptr, |
| | 13495 | buf_sprintf("expected pointer alignment of at least %" ZIG_PRI_u64 ", found %" PRIu32, |
| | 13496 | size_bytes, align_bytes)); |
| | 13497 | return ira->codegen->builtin_types.entry_invalid; |
| | 13498 | } |
| | 13499 | |
| 13491 | IrInstruction *casted_cmp_value = ir_implicit_cast(ira, cmp_value, child_type); | 13500 | IrInstruction *casted_cmp_value = ir_implicit_cast(ira, cmp_value, child_type); |
| 13492 | if (type_is_invalid(casted_cmp_value->value.type)) | 13501 | if (type_is_invalid(casted_cmp_value->value.type)) |
| 13493 | return ira->codegen->builtin_types.entry_invalid; | 13502 | return ira->codegen->builtin_types.entry_invalid; |