Skip to content

Non returning instrinsics should be handled properly #734

@adpaco-aws

Description

@adpaco-aws

The hooks.rs file handles the abort intrinsic before even calling codegen_intrinsic in this piece of code:

    fn handle(
        &self,
        tcx: &mut GotocCtx<'tcx>,
        instance: Instance<'tcx>,
        fargs: Vec<Expr>,
        assign_to: Option<Place<'tcx>>,
        target: Option<BasicBlock>,
        span: Option<Span>,
    ) -> Stmt {
        let loc = tcx.codegen_span_option(span);
        if tcx.symbol_name(instance) == "abort" {
            Stmt::assert_false("abort intrinsic reached", loc)
        } else {
            let p = assign_to.unwrap();
            let target = target.unwrap();
            Stmt::block(
                vec![
                    tcx.codegen_intrinsic(instance, fargs, &p, span),
                    Stmt::goto(tcx.current_fn().find_label(&target), loc.clone()),
                ],
                loc,
            )
        }
    }
}

This special case should be removed to handle abort in codegen_intrinsic

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions