Skip to content

Implicit return double-frees in some situations #1023

Closed
@marijnh

Description

@marijnh

The function below (in trans.rs) works fine as long as the last clause contains ret bcx;. If this is changed to simply bcx, the compiler dies on a double free when compiling the standard lib. The form of the other clauses doesn't matter -- they work with or without the ret.

fn drop_ty_immediate(bcx: @block_ctxt, v: ValueRef, t: ty::t) -> @block_ctxt {
    alt ty::struct(bcx_tcx(bcx), t) {
      ty::ty_uniq(_) | ty::ty_vec(_) | ty::ty_str. {
        ret free_ty(bcx, v, t);
      }
      ty::ty_box(_) { ret decr_refcnt_maybe_free(bcx, v, t); }
      ty::ty_ptr(_) { bcx }
    }
}

I haven't found a smaller program that produces the same issue yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions