fix const and volatile qualifiers being dropped sometimes

in the expression `&const a.b`, the const (and/or volatile)
qualifiers would be incorrectly dropped.

closes #655
This commit is contained in:
Andrew Kelley
2017-12-13 21:53:52 -05:00
parent 84619abe9f
commit f55fdc00fc
8 changed files with 39 additions and 12 deletions

View File

@@ -886,8 +886,12 @@ static void ir_print_can_implicit_cast(IrPrint *irp, IrInstructionCanImplicitCas
}
static void ir_print_ptr_type_of(IrPrint *irp, IrInstructionPtrTypeOf *instruction) {
fprintf(irp->f, "&align ");
ir_print_other_instruction(irp, instruction->align_value);
fprintf(irp->f, "&");
if (instruction->align_value != nullptr) {
fprintf(irp->f, "align(");
ir_print_other_instruction(irp, instruction->align_value);
fprintf(irp->f, ")");
}
const char *const_str = instruction->is_const ? "const " : "";
const char *volatile_str = instruction->is_volatile ? "volatile " : "";
fprintf(irp->f, ":%" PRIu32 ":%" PRIu32 " %s%s", instruction->bit_offset_start, instruction->bit_offset_end,