Skip to content

Commit

Permalink
Fixed bug with dereference operator not working as intended under som…
Browse files Browse the repository at this point in the history
…e circumstances
  • Loading branch information
IsaacShelton committed Jan 7, 2025
1 parent b639840 commit f649595
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lower/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,13 @@ pub fn lower_expr(
)?),
ExprKind::Dereference(subject) => {
let ir_type = lower_type(ir_module, &builder.unpoly(&subject.ty)?, asg)?;

let ir::Type::Ptr(ir_type) = ir_type else {
panic!("Cannot lower dereference of non-pointer");
};

let value = lower_expr(builder, ir_module, &subject.expr, function, asg)?;
Ok(builder.push(ir::Instr::Load((value, ir_type))))
Ok(builder.push(ir::Instr::Load((value, *ir_type))))
}
ExprKind::Conditional(conditional) => {
let resume_basicblock_id = builder.new_block();
Expand Down

0 comments on commit f649595

Please sign in to comment.