Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit return double-frees in some situations #1023

Closed
marijnh opened this issue Oct 11, 2011 · 1 comment
Closed

Implicit return double-frees in some situations #1023

marijnh opened this issue Oct 11, 2011 · 1 comment

Comments

@marijnh
Copy link
Contributor

marijnh commented Oct 11, 2011

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.

@marijnh
Copy link
Contributor Author

marijnh commented Oct 11, 2011

This was in fact something that I already fixed yesterday, but is still present in the stage0 compiler. Will be gone by the next snapshot.

@marijnh marijnh closed this as completed Oct 11, 2011
bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 26, 2020
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Add a test for `bswap`

* Address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant