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 building panic_unwind (stage 1) in debug mode with incremental compilation #49153

Closed
abonander opened this issue Mar 19, 2018 · 5 comments · Fixed by #49200
Closed

ICE building panic_unwind (stage 1) in debug mode with incremental compilation #49153

abonander opened this issue Mar 19, 2018 · 5 comments · Fixed by #49200
Assignees
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@abonander
Copy link
Contributor

abonander commented Mar 19, 2018

  • fresh clone of master
  • using local Rust and Cargo latest nightly (also occurs in beta-1.25.0),
  • MSVC x64 with Visual Studio 2017

In config.toml:

  • set build.cargo and build.rustc to Rustup's proxies
  • set rust.debug = true (happens only in debug mode)
  • set codegen-units = 0 (specific value doesn't appear to affect the issue)
  • run x.py build

It gets to this point and ICEs:

Building stage1 std artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc)
   Compiling core v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libcore)
   Compiling cc v1.0.6
   Compiling unwind v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libunwind)
   Compiling cfg-if v0.1.2
   Compiling filetime v0.1.15
   Compiling build_helper v0.1.0 (file:///C:/Users/cyber/Rust/rust/src/build_helper)
   Compiling compiler_builtins v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/rustc/compiler_builtins_shim)
   Compiling alloc_jemalloc v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/liballoc_jemalloc)
   Compiling std v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libstd)
   Compiling std_unicode v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libstd_unicode)
   Compiling libc v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/rustc/libc_shim)
   Compiling panic_abort v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libpanic_abort)
   Compiling alloc v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/liballoc)
   Compiling panic_unwind v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libpanic_unwind)
   Compiling alloc_system v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/liballoc_system)
�[0m�[38;5;9m�[1merror: internal compiler error�[0m�[0m�[38;5;15m�[1m: librustc\ty\maps\on_disk_cache.rs:830: alloc id without corresponding allocation: 39�[0m

thread 'rustc' panicked at 'Box<Any>', librustc_errors\lib.rs:543:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.26.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z force-unstable-if-unmarked -C debug-assertions=off -C overflow-checks=on -C incremental -C prefer-dynamic -C debug-assertions=y -C codegen-units=8 -C target-feature=+crt-static --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `panic_unwind`.

Caused by:
  process didn't exit successfully: `C:\Users\cyber\Rust\rust\build\bootstrap/debug/rustc --crate-name panic_unwind libpanic_unwind\lib.rs --error-format json --crate-type lib --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on -C metadata=730d0c4f6ad8f657 -C extra-filename=-730d0c4f6ad8f657 --out-dir C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps --target x86_64-pc-windows-msvc -C incremental=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\incremental -L dependency=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps -L dependency=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\debug\deps --extern alloc=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\liballoc-0ac88ae22893c7ce.rlib --extern unwind=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\libunwind-75ec301683f1f6ba.rlib --extern core=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\libcore-814295c4539117a2.rlib --extern libc=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\liblibc-766a10703183d997.rlib` (exit code: 101)
warning: build failed, waiting for other jobs to finish...

I grepped the error message (alloc id without corresponding allocation) and it points to this line which appears to be associated with incremental compilation, which makes sense because this only triggers when building in debug mode and setting CARGO_INCREMENTAL=false avoids the ICE.

cc @alexcrichton rust-lang/cargo#4817

@abonander abonander changed the title ICE building panic_unwind (stage 1) in debug mode with incremental compilation ICE building panic_unwind (stage 1) in debug mode with incremental compilation and local Rust Mar 19, 2018
@abonander abonander changed the title ICE building panic_unwind (stage 1) in debug mode with incremental compilation and local Rust ICE building panic_unwind (stage 1) in debug mode with incremental compilation Mar 19, 2018
@sapphire-arches sapphire-arches added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. labels Mar 19, 2018
@oli-obk oli-obk self-assigned this Mar 19, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Mar 19, 2018

There's a very high chance that this is fixed by #49079

@abonander
Copy link
Contributor Author

I'll try to build the latest master and see what happens.

@abonander
Copy link
Contributor Author

abonander commented Mar 20, 2018

@oli-obk Nope, just changed the file the error is emitted from. 😕

Building stage1 std artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc)
   Compiling cc v1.0.6
   Compiling core v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libcore)
   Compiling cfg-if v0.1.2
   Compiling unwind v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libunwind)
   Compiling filetime v0.1.15
   Compiling build_helper v0.1.0 (file:///C:/Users/cyber/Rust/rust/src/build_helper)
   Compiling compiler_builtins v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/rustc/compiler_builtins_shim)
   Compiling std v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libstd)
   Compiling alloc_jemalloc v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/liballoc_jemalloc)
   Compiling libc v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/rustc/libc_shim)
   Compiling std_unicode v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libstd_unicode)
   Compiling panic_abort v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libpanic_abort)
   Compiling alloc v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/liballoc)
   Compiling panic_unwind v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/libpanic_unwind)
   Compiling alloc_system v0.0.0 (file:///C:/Users/cyber/Rust/rust/src/liballoc_system)
�[0m�[38;5;9m�[1merror: internal compiler error�[0m�[0m�[38;5;15m�[1m: librustc\mir\interpret\mod.rs:184: alloc id without corresponding allocation: 39�[0m

thread 'rustc' panicked at 'Box<Any>', librustc_errors\lib.rs:543:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.26.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z force-unstable-if-unmarked -C debug-assertions=off -C overflow-checks=on -C incremental -C prefer-dynamic -C debug-assertions=y -C codegen-units=8 -C target-feature=+crt-static --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `panic_unwind`.

Caused by:
  process didn't exit successfully: `C:\Users\cyber\Rust\rust\build\bootstrap/debug/rustc --crate-name panic_unwind libpanic_unwind\lib.rs --error-format json --crate-type lib --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on -C metadata=730d0c4f6ad8f657 -C extra-filename=-730d0c4f6ad8f657 --out-dir C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps --target x86_64-pc-windows-msvc -C incremental=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\incremental -L dependency=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps -L dependency=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\debug\deps --extern core=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\libcore-814295c4539117a2.rlib --extern alloc=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\liballoc-0ac88ae22893c7ce.rlib --extern libc=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\liblibc-766a10703183d997.rlib --extern unwind=C:\Users\cyber\Rust\rust\build\x86_64-pc-windows-msvc\stage1-std\x86_64-pc-windows-msvc\debug\deps\libunwind-75ec301683f1f6ba.rlib` (exit code: 101)
warning: build failed, waiting for other jobs to finish...
error: build failed
thread 'main' panicked at 'command did not execute successfully: "C:/Users/cyber/.cargo/bin/cargo.exe" "build" "--target" "x86_64-pc-windows-msvc" "-j" "8" "--features" "panic-unwind debug-jemalloc backtrace" "--manifest-path" "C:\\Users\\cyber\\Rust\\rust\\src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101', bootstrap\compile.rs:1096:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failed to run: C:\Users\cyber\Rust\rust\build\bootstrap\debug\bootstrap build
Build completed unsuccessfully in 0:25:34

I have the backtrace here if you like but it's more than 100 frames deep so I don't know how much context you need.

@oli-obk
Copy link
Contributor

oli-obk commented Mar 20, 2018

Thanks. I'll have a look. No need for a backtrace

@oli-obk
Copy link
Contributor

oli-obk commented Mar 20, 2018

Repro:

extern "C" {
    pub static __ImageBase: u8;
}

pub static FOO: &'static u8 = unsafe { &__ImageBase };

The problem is that extern statics don't have allocations (because it makes no sense for them to have usable memory during const evaluation).

This is easy to fix :)

bors added a commit that referenced this issue Mar 21, 2018
…ster

Encode/decode extern statics in metadata and incremental cache

fixes #49153

cc @abonander

r? @michaelwoerister incremental ICE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants