Skip to content

cycle collection crash #982

Description

@jruderman
tag maybe_pointy {
    no_pointy;
    yes_pointy(@pointy);
}

type pointy = {
    mutable x : maybe_pointy
};

iter allunder(n: uint) -> uint {
    let i: uint = 0u;
    while i < n { put i; i += 1u; }
}

fn main()
{
    const max : uint = 10u;

    let v : [mutable @pointy] = [mutable];
    for each i in allunder(max) {
        v += [mutable @{ mutable x : no_pointy }];
    }

    v[0].x = yes_pointy(v[1]);
    v[1].x = yes_pointy(v[0]);

    for each i in allunder(max) {
        v[i] = @{ mutable x : no_pointy };
    }
}

Crashes 90% of the time.

Activity

  1. jruderman commented on Sep 27, 2011

    @jruderman
    ContributorAuthor

    Sorry, this only crashes (90% of the time) with RUST_CC_ZEAL.

  2. catamorphism commented on Mar 15, 2012

    @catamorphism
    Contributor

    Assigning to myself so I can try to reproduce.

  3. catamorphism commented on Mar 15, 2012

    @catamorphism
    Contributor

    I'm closing because the example code no longer works (iter is no longer a thing). @jruderman , if you can reproduce with a current example, feel free to reopen or file a new bug.

  4. jruderman commented on Mar 15, 2012

    @jruderman
    ContributorAuthor

    An updated version of this testcase passes, even with RUST_CC_ZEAL :)

    enum maybe_pointy {
        no_pointy,
        yes_pointy(@pointy)
    }
    
    type pointy = {
        mutable x : maybe_pointy
    };
    
    fn main()
    {
        const max : uint = 10u;
    
        let v : [mutable @pointy] = [mutable];
        uint::range(0u, max) {|_i|
            v += [mutable @{ mutable x : no_pointy }];
        }
    
        v[0].x = yes_pointy(v[1]);
        v[1].x = yes_pointy(v[0]);
    
        uint::range(0u, max) {|i|
            v[i] = @{ mutable x : no_pointy };
        }
    }
    
  5. added a commit that references this issue on Oct 26, 2020
  6. added a commit that references this issue on Aug 5, 2023
  7. added 2 commits that reference this issue on Aug 21, 2026
  8. added a commit that references this issue on Sep 24, 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-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions