Skip to content

Unused move causes a crash #3878

Closed
Closed

Description

@jruderman
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

Activity

  1. nikomatsakis commented on Oct 27, 2012

    @nikomatsakis
    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.

  2. vertexclique commented on Oct 30, 2012

    @vertexclique
    Contributor

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

  3. added a commit that references this issue on Nov 1, 2012
  4. catamorphism commented on Nov 1, 2012

    @catamorphism
    Contributor

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

    9d276b1

  5. vertexclique commented on Nov 1, 2012

    @vertexclique
    Contributor

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

  6. added a commit that references this issue on Sep 17, 2024
  7. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions