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

Unused move causes a crash #3878

Closed
jruderman opened this issue Oct 27, 2012 · 4 comments
Closed

Unused move causes a crash #3878

jruderman opened this issue Oct 27, 2012 · 4 comments
Labels
A-codegen Area: Code generation E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@jruderman
Copy link
Contributor

fn main()
{
    let y = ~1;
    move y;
}

a.out(43383,0x10065f000) malloc:
*** error for object 0x7ffed14144d0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

@nikomatsakis
Copy link
Contributor

I think the problem is that, when translating expr_unary_move, if the dest is "ignore", we drop the lvalue but do not zero it.

@vertexclique
Copy link
Member

Which fn we use instead of drop_val( lvalue ) in "Ignore" case?

@catamorphism
Copy link
Contributor

This was merged in already, but I also added the test case:

9d276b1

@vertexclique
Copy link
Member

@catamorphism I see him there src/test/run-pass/unused-move.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

4 participants