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

ICE - Option Refcount causes an LLVM assertion to fail. #21533

Closed
DavidJFelix opened this issue Jan 23, 2015 · 8 comments
Closed

ICE - Option Refcount causes an LLVM assertion to fail. #21533

DavidJFelix opened this issue Jan 23, 2015 · 8 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@DavidJFelix
Copy link

The following code:

use std::rc::Rc

struct ProblemType {
    children [Option<Rc<ProblemType>>; 8],
}

impl ProblemType {
    fn breaks_compiler() -> Option<Rc<ProblemType>> {
        None
    }
}

Causes LLVM to fail an assertion, claiming:

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/DataLayout.cpp:636: unsigned int llvm::DataLayout::getAlignment(llvm::Type*, bool) const: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"' failed.
@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 23, 2015
@dotdash
Copy link
Contributor

dotdash commented Feb 14, 2015

Reduced test case:

struct Outer(*mut ProblemType);
struct ProblemType ([Outer; 8]);

fn breaks_compiler(_: Outer) {}

@dotdash
Copy link
Contributor

dotdash commented Feb 15, 2015

This depends on the array in ProblemType being fixed sized, and ProblemType being either a struct or a single variant enum. Under those conditions, the code ends up trying to get the size of Outer in a state where the struct body has not yet been set.

@tamird
Copy link
Contributor

tamird commented Apr 22, 2015

Triage: no longer ICEs.

The original case:

use std::rc::Rc;

struct ProblemType {
    children: [Option<Rc<ProblemType>>; 8],
}

impl ProblemType {
    fn breaks_compiler() -> Option<Rc<ProblemType>> {
        None
    }
}

fn main() {
    // Add code here
}

as well as the reduced test case now compile without error.

@pmarcelll
Copy link
Contributor

On my machine both test cases fail with the ICE mentioned in the first comment.

rustc 1.2.0-nightly (0250ff9a5 2015-06-17)

@arielb1
Copy link
Contributor

arielb1 commented Jul 8, 2015

Confirming still ICEs

@wheals
Copy link
Contributor

wheals commented Oct 25, 2015

This is strange: it compiles fine in stable and beta (also with rustc 1.2.0), but fails in nightly.

@arielb1
Copy link
Contributor

arielb1 commented Oct 26, 2015

@wheals

LLVM assertions are disabled in stable/beta.

@arielb1
Copy link
Contributor

arielb1 commented Oct 27, 2015

duplicate of #19001

@arielb1 arielb1 closed this as completed Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

7 participants