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

LLVM ERROR compiling Clap on 1.17.0 Nightly #40214

Closed
leonardo-m opened this Issue Mar 2, 2017 · 15 comments

Comments

Projects
None yet
8 participants
@leonardo-m
Copy link

leonardo-m commented Mar 2, 2017

As reported here:
https://users.rust-lang.org/t/mandel-rust-v0-4/7481/3

Compiling this little project:
https://github.com/willi-kappler/mandel-rust

On x86_64-pc-windows-gnu, rustc 1.17.0-nightly, 691eba1 2017-03-01:

Instruction does not dominate all uses!
%27 = load i32, i32* %26, !range !2
%71 = icmp eq i32 %27, 60
LLVM ERROR: Broken function found, compilation aborted!
error: Could not compile clap.

Further notes:

I can confirm this on MacOS and Linux. Stable and beta ran fine, but nightly has problems on both platforms

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Mar 9, 2017

Only happens with --release for me on macOS.

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Mar 9, 2017

First bad: 1572bf104 2017-02-25
Last good: 08230775a 2017-02-24

Changes

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Mar 9, 2017

Note that while the error does not occur when everything is compiled in debug mode, it does occur when clap itself is compiled with -Copt-level=0 but all the dependencies are -Copt-level=3.

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Mar 9, 2017

It also sounds a lot like an LLVM bug, since the issue happens during LLVM passes – should check if LLVM 4.0 works or not. Us giving LLVM more information is most likely the trigger.

My bad! It is us who are generating bad IR!

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Mar 9, 2017

@nagisa: This also fails with LLVM 4.0

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Mar 9, 2017

Minimal-ish reproducer:

pub fn name(c: char) -> char {
    while let Some(c) = Some('[') {
        break;
    }
    c
}

Another interesting case is

    while let Some(c) = Some('[') {
    }
    c

Which ICEs:

error: internal compiler error: /checkout/src/librustc_trans/mir/operand.rs:189: use of _8 before def

This points pretty squarely on the normalize breaks PR.

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Mar 9, 2017

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Mar 9, 2017

cc me

@nikomatsakis nikomatsakis self-assigned this Mar 9, 2017

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Mar 9, 2017

Is this a dup of #40235? (Fixed in #40242)

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Mar 10, 2017

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Mar 10, 2017

Reproduced, rather. I recommend trying to re-reproduce.

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Mar 10, 2017

@nagisa Doing that now. The easy way to check if you have the bugfix from #40242 is to see if this tries to compile (it did before the bugfix, but not after):

pub fn name(c: char) -> char {
    while let Some(t) = Some('[') {
        break;
    }
    t
}
@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Mar 11, 2017

Seems to be fixed in master, so all we need is a nightly release (our current is from 03-03)

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Mar 11, 2017

That was what I found, too. Sorry, forgot to post my results.

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Mar 14, 2017

#40214 (comment) does not reproduce on the current nightly. closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.