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] with mir-opt-level=3 #50411

Closed
leonardo-m opened this issue May 3, 2018 · 4 comments
Closed

[ICE] with mir-opt-level=3 #50411

leonardo-m opened this issue May 3, 2018 · 4 comments
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@leonardo-m
Copy link

fn main() {
    let _ = (0 .. 1).filter(|_| [1].iter().all(|_| true)).count();
}

Compiling with:

rustc -Z mir-opt-level=3 test.rs

Gives:

error: internal compiler error: librustc_mir\dataflow\move_paths\builder.rs:296: SetDiscriminant should not exist during borrowck

thread 'main' panicked at 'Box<Any>', librustc_errors\lib.rs:499:9
stack backtrace:
   0: mingw_set_invalid_parameter_handler
   1: mingw_set_invalid_parameter_handler
   2: mingw_set_invalid_parameter_handler
   3: mingw_set_invalid_parameter_handler
   4: mingw_set_invalid_parameter_handler
   5: mingw_set_invalid_parameter_handler
   6: mingw_set_invalid_parameter_handler
   7: mingw_set_invalid_parameter_handler
   8: mingw_set_invalid_parameter_handler
   9: mingw_set_invalid_parameter_handler
  10: mingw_set_invalid_parameter_handler
  11: mingw_set_invalid_parameter_handler
  12: mingw_set_invalid_parameter_handler
  13: mingw_set_invalid_parameter_handler
  14: mingw_set_invalid_parameter_handler
  15: mingw_set_invalid_parameter_handler
  16: mingw_set_invalid_parameter_handler
  17: mingw_set_invalid_parameter_handler
  18: mingw_set_invalid_parameter_handler
  19: mingw_set_invalid_parameter_handler
  20: mingw_set_invalid_parameter_handler
  21: mingw_set_invalid_parameter_handler
  22: mingw_set_invalid_parameter_handler
  23: mingw_set_invalid_parameter_handler
  24: mingw_set_invalid_parameter_handler
  25: mingw_set_invalid_parameter_handler
  26: mingw_set_invalid_parameter_handler
  27: mingw_set_invalid_parameter_handler
  28: mingw_set_invalid_parameter_handler
  29: mingw_set_invalid_parameter_handler
  30: mingw_set_invalid_parameter_handler
  31: mingw_set_invalid_parameter_handler
  32: mingw_set_invalid_parameter_handler
  33: mingw_set_invalid_parameter_handler
  34: mingw_set_invalid_parameter_handler
  35: mingw_set_invalid_parameter_handler
  36: mingw_set_invalid_parameter_handler
  37: mingw_set_invalid_parameter_handler
  38: mingw_set_invalid_parameter_handler
  39: mingw_set_invalid_parameter_handler
  40: mingw_set_invalid_parameter_handler
  41: mingw_set_invalid_parameter_handler
  42: mingw_set_invalid_parameter_handler
  43: mingw_set_invalid_parameter_handler
  44: mingw_set_invalid_parameter_handler
  45: mingw_set_invalid_parameter_handler
  46: mingw_set_invalid_parameter_handler
  47: mingw_set_invalid_parameter_handler
  48: mingw_set_invalid_parameter_handler
  49: std::rt::lang_start::{{closure}}
  50: mingw_set_invalid_parameter_handler
  51: mingw_set_invalid_parameter_handler
  52: mingw_set_invalid_parameter_handler
  53: main
  54: _tmainCRTStartup
  55: mainCRTStartup
  56: mingw_set_invalid_parameter_handler
  57: mingw_set_invalid_parameter_handler
query stack during panic:
#0 [optimized_mir] processing `main::{{closure}}`
#1 [collect_and_partition_translation_items] collect_and_partition_translation_items
end of query stack
error: aborting due to previous error

note: rustc 1.27.0-nightly (8a37c75a3 2018-05-02) running on x86_64-pc-windows-gnu

note: compiler flags: -Z mir-opt-level=3
rustc 1.27.0-nightly (8a37c75a3 2018-05-02)
binary: rustc
commit-hash: 8a37c75a3a661385cc607d934c70e86a9eaf5fd7
commit-date: 2018-05-02
host: x86_64-pc-windows-gnu
release: 1.27.0-nightly
LLVM version: 6.0
@cuviper cuviper added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. labels May 4, 2018
@bjorn3
Copy link
Member

bjorn3 commented Aug 13, 2018

This happened to me when compiling libcore with -Zmir-opt-level=2.

@RalfJung
Copy link
Member

I cannot reproduce this ICE any more.

@RalfJung RalfJung added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 15, 2018
@RalfJung
Copy link
Member

It's in the nightly, but not in current master. So likely #55046 fixed it?

@RalfJung RalfJung removed the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 15, 2018
@RalfJung
Copy link
Member

RalfJung commented Oct 15, 2018

Ah dang, I was too quick. The issue only occurs if you compile your libstd without -Zalways-encode-mir. And it still occurs.

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Oct 20, 2018
wesleywiser pushed a commit to wesleywiser/rust that referenced this issue Oct 23, 2018
When inlining a function using the Mir inliner, we shouldn't rerun the
various Mir passes on it because the Mir has already been lowered and
that wil break various early Mir passes.

The issue in rust-lang#50411 is that we've inlined a function with promotions
whose Mir has already been lowered. The promotions are then copied into
the local function and we begin to run passes on their lowered Mir
which causes the ICE.

Fixes rust-lang#50411
pietroalbini added a commit to pietroalbini/rust that referenced this issue Oct 25, 2018
…akis

Don't rerun MIR passes when inlining

Fixes rust-lang#50411

r? @nikomatsakis

I updated your commit message with additional details. Let me know if any of that is incorrect. I also added the appropriate `compile-flags` directive to the test.

Thanks for you help on this!

cc @RalfJung related to your PR rust-lang#55086
kennytm added a commit to kennytm/rust that referenced this issue Oct 28, 2018
…akis

Don't rerun MIR passes when inlining

Fixes rust-lang#50411

r? @nikomatsakis

I updated your commit message with additional details. Let me know if any of that is incorrect. I also added the appropriate `compile-flags` directive to the test.

Thanks for you help on this!

cc @RalfJung related to your PR rust-lang#55086
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants