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

proc_macro crate fails to build with llvm LLVM_ENABLE_EXPENSIVE_CHECKS #104173

Open
matthiaskrgr opened this issue Nov 8, 2022 · 3 comments
Open
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Nov 8, 2022

Soooo I was trying to build rustc with a llvm that has LLVM_ENABLE_EXPENSIVE_CHECKS on for some extra asserts, but it turns out that we can't even build std artifacts like that 😅

To turn on expensive checks

diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 94a61b727a3..d57ecab838f 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -385,6 +385,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
             .define("LLVM_ENABLE_LIBEDIT", "OFF")
             .define("LLVM_ENABLE_BINDINGS", "OFF")
             .define("LLVM_ENABLE_Z3_SOLVER", "OFF")
+            .define("LLVM_ENABLE_EXPENSIVE_CHECKS", "ON")
             .define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
             .define("LLVM_TARGET_ARCH", target_native.split('-').next().unwrap())
             .define("LLVM_DEFAULT_TARGET_TRIPLE", target_native);

cat config.toml | grep -v "^#" | grep -v "^$"

changelog-seen = 2
[llvm]
download-ci-llvm = false
assertions = true
ccache = "/home/matthias/.cargo/bin/sccache"
ninja = true
targets = "X86"
link-jobs = 2
cflags = "-march=native" # -D_GLIBCXX_DEBUG
cxxflags = "-march=native" # -D_GLIBCXX_DEBUG
ldflags = "-march=native" # -D_GLIBCXX_DEBUG
[build]
extended = true
tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"] # + "rust-demangler" if `profiler`
low-priority = true
[install]
[rust]
debug = true
debug-assertions = true
debug-assertions-std = true
overflow-checks = true
overflow-checks-std = true
debuginfo-level = 1
backtrace-on-ice = true
verify-llvm-ir = true
[target.x86_64-unknown-linux-gnu]
[dist]

Then I built using RUSTFLAGS="" ./x.py build

rustc --version --verbose:

rust repo @ c5842b0be783dffa5a49693541acb79115c7eeef
Backtrace

....

Copy "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-dis" to "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-dis"
Copy "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/llvm/build/bin/llc" to "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin/llc"
Copy "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/llvm/build/bin/opt" to "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin/opt"
  c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
Copy "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/rustc-main" to "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/bin/rustc"
< Assemble { target_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
> Std { target: x86_64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, crates: [] }
  > StartupObjects { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu }
  < StartupObjects { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu }
  c Assemble { target_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
  c Libdir { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu }
  c Libdir { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu }
  c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
  c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
  c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
  c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu } }
Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
running: "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zcheck-cfg=names,values,output" "-Zbinary-dep-depinfo" "-j" "1" "-v" "-v" "-v" "-v" "-v" "-v" "-v" "--release" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/home/matthias/vcs/github/rust_debug_assertions/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
       Fresh cc v1.0.73
       Fresh core v0.0.0 (/home/matthias/vcs/github/rust_debug_assertions/library/core)
       Fresh rustc-std-workspace-core v1.99.0 (/home/matthias/vcs/github/rust_debug_assertions/library/rustc-std-workspace-core)
       Fresh compiler_builtins v0.1.82
       Fresh alloc v0.0.0 (/home/matthias/vcs/github/rust_debug_assertions/library/alloc)
       Fresh rustc-std-workspace-alloc v1.99.0 (/home/matthias/vcs/github/rust_debug_assertions/library/rustc-std-workspace-alloc)
       Fresh libc v0.2.135
       Fresh cfg-if v1.0.0
       Fresh unwind v0.0.0 (/home/matthias/vcs/github/rust_debug_assertions/library/unwind)
       Fresh memchr v2.5.0
       Fresh gimli v0.26.1
       Fresh adler v1.0.2
       Fresh miniz_oxide v0.5.3
       Fresh addr2line v0.17.0
       Fresh object v0.29.0
       Fresh panic_unwind v0.0.0 (/home/matthias/vcs/github/rust_debug_assertions/library/panic_unwind)
       Fresh std_detect v0.1.5 (/home/matthias/vcs/github/rust_debug_assertions/library/stdarch/crates/std_detect)
       Fresh panic_abort v0.0.0 (/home/matthias/vcs/github/rust_debug_assertions/library/panic_abort)
       Fresh hashbrown v0.12.3
       Fresh rustc-demangle v0.1.21
       Fresh std v0.0.0 (/home/matthias/vcs/github/rust_debug_assertions/library/std)
       Fresh rustc-std-workspace-std v1.99.0 (/home/matthias/vcs/github/rust_debug_assertions/library/rustc-std-workspace-std)
       Fresh unicode-width v0.1.10
       Fresh getopts v0.2.21
   Compiling proc_macro v0.0.0 (/home/matthias/vcs/github/rust_debug_assertions/library/proc_macro)
     Running `CARGO=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/bin/cargo CARGO_CRATE_NAME=proc_macro CARGO_MANIFEST_DIR=/home/matthias/vcs/github/rust_debug_assertions/library/proc_macro CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=proc_macro CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/release/deps:/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/lib' /home/matthias/.cargo/bin/sccache /home/matthias/vcs/github/rust_debug_assertions/build/bootstrap/debug/rustc --crate-name proc_macro --edition=2021 library/proc_macro/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=1 -C debug-assertions=on -Zunstable-options --check-cfg 'names()' --check-cfg 'values()' -C metadata=de3ffe529f393522 -C extra-filename=-de3ffe529f393522 --out-dir /home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern core=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-05d65ceee8b68e1f.rmeta --extern std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.so --extern std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.rlib -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_os,"watchos")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","nvptx64","le32","xtensa")' '--check-cfg=values(dont_compile_me)' '--check-cfg=values(rustix_use_libc)' -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Csplit-debuginfo=off -Zsave-analysis -Cprefer-dynamic -Cembed-bitcode=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-1dd36b1385d26063/out`
sccache: warning: The server looks like it shut down unexpectedly, compiling locally instead
[RUSTC-SHIM] rustc proc_macro env[0]: "CARGO"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/bin/cargo"
[RUSTC-SHIM] rustc proc_macro env[1]: "CARGO_CRATE_NAME"="proc_macro"
[RUSTC-SHIM] rustc proc_macro env[2]: "CARGO_INCREMENTAL"="0"
[RUSTC-SHIM] rustc proc_macro env[3]: "CARGO_MAKEFLAGS"="-j --jobserver-fds=15,16 --jobserver-auth=15,16"
[RUSTC-SHIM] rustc proc_macro env[4]: "CARGO_MANIFEST_DIR"="/home/matthias/vcs/github/rust_debug_assertions/library/proc_macro"
[RUSTC-SHIM] rustc proc_macro env[5]: "CARGO_PKG_AUTHORS"=""
[RUSTC-SHIM] rustc proc_macro env[6]: "CARGO_PKG_DESCRIPTION"=""
[RUSTC-SHIM] rustc proc_macro env[7]: "CARGO_PKG_HOMEPAGE"=""
[RUSTC-SHIM] rustc proc_macro env[8]: "CARGO_PKG_LICENSE"=""
[RUSTC-SHIM] rustc proc_macro env[9]: "CARGO_PKG_LICENSE_FILE"=""
[RUSTC-SHIM] rustc proc_macro env[10]: "CARGO_PKG_NAME"="proc_macro"
[RUSTC-SHIM] rustc proc_macro env[11]: "CARGO_PKG_REPOSITORY"=""
[RUSTC-SHIM] rustc proc_macro env[12]: "CARGO_PKG_RUST_VERSION"=""
[RUSTC-SHIM] rustc proc_macro env[13]: "CARGO_PKG_VERSION"="0.0.0"
[RUSTC-SHIM] rustc proc_macro env[14]: "CARGO_PKG_VERSION_MAJOR"="0"
[RUSTC-SHIM] rustc proc_macro env[15]: "CARGO_PKG_VERSION_MINOR"="0"
[RUSTC-SHIM] rustc proc_macro env[16]: "CARGO_PKG_VERSION_PATCH"="0"
[RUSTC-SHIM] rustc proc_macro env[17]: "CARGO_PKG_VERSION_PRE"=""
[RUSTC-SHIM] rustc proc_macro env[18]: "CARGO_PROFILE_RELEASE_DEBUG"="1"
[RUSTC-SHIM] rustc proc_macro env[19]: "CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS"="true"
[RUSTC-SHIM] rustc proc_macro env[20]: "CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS"="true"
[RUSTC-SHIM] rustc proc_macro env[21]: "CARGO_TARGET_DIR"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std"
[RUSTC-SHIM] rustc proc_macro env[22]: "RUSTBUILD_NATIVE_DIR"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/native"
[RUSTC-SHIM] rustc proc_macro env[23]: "RUSTC"="/home/matthias/vcs/github/rust_debug_assertions/build/bootstrap/debug/rustc"
[RUSTC-SHIM] rustc proc_macro env[24]: "RUSTC_BACKTRACE_ON_ICE"="1"
[RUSTC-SHIM] rustc proc_macro env[25]: "RUSTC_BOOTSTRAP"="1"
[RUSTC-SHIM] rustc proc_macro env[26]: "RUSTC_BREAK_ON_ICE"="1"
[RUSTC-SHIM] rustc proc_macro env[27]: "RUSTC_ERROR_METADATA_DST"="/home/matthias/vcs/github/rust_debug_assertions/build/tmp/extended-error-metadata"
[RUSTC-SHIM] rustc proc_macro env[28]: "RUSTC_FORCE_UNSTABLE"="1"
[RUSTC-SHIM] rustc proc_macro env[29]: "RUSTC_INSTALL_BINDIR"="bin"
[RUSTC-SHIM] rustc proc_macro env[30]: "RUSTC_LIBDIR"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/lib"
[RUSTC-SHIM] rustc proc_macro env[31]: "RUSTC_LINT_FLAGS"="-Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros -Dwarnings"
[RUSTC-SHIM] rustc proc_macro env[32]: "RUSTC_REAL"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/bin/rustc"
[RUSTC-SHIM] rustc proc_macro env[33]: "RUSTC_SNAPSHOT"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/bin/rustc"
[RUSTC-SHIM] rustc proc_macro env[34]: "RUSTC_SNAPSHOT_LIBDIR"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/lib"
[RUSTC-SHIM] rustc proc_macro env[35]: "RUSTC_STAGE"="1"
[RUSTC-SHIM] rustc proc_macro env[36]: "RUSTC_SYSROOT"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1"
[RUSTC-SHIM] rustc proc_macro env[37]: "RUSTC_VERBOSE"="7"
[RUSTC-SHIM] rustc proc_macro env[38]: "RUSTC_WRAPPER"="/home/matthias/.cargo/bin/sccache"
[RUSTC-SHIM] rustc proc_macro env[39]: "RUSTDOC"="/home/matthias/vcs/github/rust_debug_assertions/build/bootstrap/debug/rustdoc"
[RUSTC-SHIM] rustc proc_macro env[40]: "RUSTDOCFLAGS"="-Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options --check-cfg=values(bootstrap) --check-cfg=values(stdarch_intel_sde) --check-cfg=values(no_fp_fmt_parse) --check-cfg=values(no_global_oom_handling) --check-cfg=values(no_rc) --check-cfg=values(no_sync) --check-cfg=values(freebsd12) --check-cfg=values(backtrace_in_libstd) --check-cfg=values(target_env,\"libnx\") --check-cfg=values(target_os,\"watchos\") --check-cfg=values(target_arch,\"asmjs\",\"spirv\",\"nvptx\",\"nvptx64\",\"le32\",\"xtensa\") --check-cfg=values(dont_compile_me) --check-cfg=values(rustix_use_libc) -Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.67.0-dev -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")"
[RUSTC-SHIM] rustc proc_macro env[41]: "RUSTDOC_REAL"="/path/to/nowhere/rustdoc/not/required"
[RUSTC-SHIM] rustc proc_macro env[42]: "RUSTFLAGS"="-Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options --check-cfg=values(bootstrap) --check-cfg=values(stdarch_intel_sde) --check-cfg=values(no_fp_fmt_parse) --check-cfg=values(no_global_oom_handling) --check-cfg=values(no_rc) --check-cfg=values(no_sync) --check-cfg=values(freebsd12) --check-cfg=values(backtrace_in_libstd) --check-cfg=values(target_env,\"libnx\") --check-cfg=values(target_os,\"watchos\") --check-cfg=values(target_arch,\"asmjs\",\"spirv\",\"nvptx\",\"nvptx64\",\"le32\",\"xtensa\") --check-cfg=values(dont_compile_me) --check-cfg=values(rustix_use_libc) -Zmacro-backtrace -Clink-args=-Wl,-z,origin -Clink-args=-Wl,-rpath,$ORIGIN/../lib -Csplit-debuginfo=off -Zsave-analysis -Cprefer-dynamic -Cembed-bitcode=yes -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")"
[RUSTC-SHIM] rustc proc_macro env[43]: "RUST_COMPILER_RT_ROOT"="/home/matthias/vcs/github/rust_debug_assertions/src/llvm-project/compiler-rt"
[RUSTC-SHIM] rustc proc_macro env[44]: "RUST_SAVE_ANALYSIS_CONFIG"="{\"output_file\": null,\"full_docs\": false,\"pub_only\": true,\"reachable_only\": false,\"distro_crate\": true,\"signatures\": false,\"borrow_data\": false}"
[RUSTC-SHIM] rustc proc_macro env[45]: "RUST_TEST_THREADS"="1"
[RUSTC-SHIM] rustc proc_macro working directory: /home/matthias/vcs/github/rust_debug_assertions
[RUSTC-SHIM] rustc proc_macro command: "LD_LIBRARY_PATH"="/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/lib:/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/release/deps:/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/lib" "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "--crate-name" "proc_macro" "--edition=2021" "library/proc_macro/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "debuginfo=1" "-C" "debug-assertions=on" "-Zunstable-options" "--check-cfg" "names()" "--check-cfg" "values()" "-C" "metadata=de3ffe529f393522" "-C" "extra-filename=-de3ffe529f393522" "--out-dir" "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps" "--target" "x86_64-unknown-linux-gnu" "-L" "dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/release/deps" "--extern" "core=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-05d65ceee8b68e1f.rmeta" "--extern" "std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.so" "--extern" "std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.rlib" "-Csymbol-mangling-version=legacy" "-Zunstable-options" "-Zunstable-options" "--check-cfg=values(bootstrap)" "--check-cfg=values(stdarch_intel_sde)" "--check-cfg=values(no_fp_fmt_parse)" "--check-cfg=values(no_global_oom_handling)" "--check-cfg=values(no_rc)" "--check-cfg=values(no_sync)" "--check-cfg=values(freebsd12)" "--check-cfg=values(backtrace_in_libstd)" "--check-cfg=values(target_env,\"libnx\")" "--check-cfg=values(target_os,\"watchos\")" "--check-cfg=values(target_arch,\"asmjs\",\"spirv\",\"nvptx\",\"nvptx64\",\"le32\",\"xtensa\")" "--check-cfg=values(dont_compile_me)" "--check-cfg=values(rustix_use_libc)" "-Zmacro-backtrace" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Csplit-debuginfo=off" "-Zsave-analysis" "-Cprefer-dynamic" "-Cembed-bitcode=yes" "-Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" "-Z" "binary-dep-depinfo" "-L" "native=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-1dd36b1385d26063/out" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "--sysroot" "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1" "-Z" "force-unstable-if-unmarked"
[RUSTC-SHIM] rustc proc_macro sysroot: "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1"
[RUSTC-SHIM] rustc proc_macro libdir: "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/lib"

# After Instruction Selection
# Machine code for function _ZN10proc_macro6bridge6server22RunningSameThreadGuard3new17hd07da82ffb49fc2aE: IsSSA, TracksLiveness
Frame Objects:
  fi#0: size=48, align=8, at location [SP+8]

bb.0 (%ir-block.0):
  successors: %bb.1(0x30000000), %bb.2(0x50000000); %bb.1(37.50%), %bb.2(62.50%)

  ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp, debug-location !709; library/core/src/option.rs:630:15 @[ library/std/src/thread/local.rs:802:22 @[ library/std/src/thread/local.rs:969:23 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ] ] ]
  TLS_addr64 $noreg, 1, $noreg, target-flags(x86-tlsgd) @_ZN10proc_macro6bridge6server27ALREADY_RUNNING_SAME_THREAD7__getit5__KEY17hadc6be6d27cb5446E, $noreg, implicit-def $rax, implicit-def dead $rcx, implicit-def dead $rdx, implicit-def dead $rsi, implicit-def dead $rdi, implicit-def dead $r8, implicit-def dead $r9, implicit-def dead $r10, implicit-def dead $r11, implicit-def dead $fp0, implicit-def dead $fp1, implicit-def dead $fp2, implicit-def dead $fp3, implicit-def dead $fp4, implicit-def dead $fp5, implicit-def dead $fp6, implicit-def dead $fp7, implicit-def dead $st0, implicit-def dead $st1, implicit-def dead $st2, implicit-def dead $st3, implicit-def dead $st4, implicit-def dead $st5, implicit-def dead $st6, implicit-def dead $st7, implicit-def dead $mm0, implicit-def dead $mm1, implicit-def dead $mm2, implicit-def dead $mm3, implicit-def dead $mm4, implicit-def dead $mm5, implicit-def dead $mm6, implicit-def dead $mm7, implicit-def dead $xmm0, implicit-def dead $xmm1, implicit-def dead $xmm2, implicit-def dead $xmm3, implicit-def dead $xmm4, implicit-def dead $xmm5, implicit-def dead $xmm6, implicit-def dead $xmm7, implicit-def dead $xmm8, implicit-def dead $xmm9, implicit-def dead $xmm10, implicit-def dead $xmm11, implicit-def dead $xmm12, implicit-def dead $xmm13, implicit-def dead $xmm14, implicit-def dead $xmm15, implicit-def dead $eflags, implicit-def dead $df, implicit $rsp, implicit $ssp, debug-location !709; library/core/src/option.rs:630:15 @[ library/std/src/thread/local.rs:802:22 @[ library/std/src/thread/local.rs:969:23 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ] ] ]
  ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp, debug-location !709; library/core/src/option.rs:630:15 @[ library/std/src/thread/local.rs:802:22 @[ library/std/src/thread/local.rs:969:23 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ] ] ]
  %3:gr64 = COPY $rax, debug-location !709; library/core/src/option.rs:630:15 @[ library/std/src/thread/local.rs:802:22 @[ library/std/src/thread/local.rs:969:23 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ] ] ]
  %2:gr64 = nuw INC64r %3:gr64(tied-def 0), implicit-def dead $eflags
  CMP8mi %3:gr64, 1, $noreg, 0, $noreg, 0, implicit-def $eflags, debug-location !742 :: (dereferenceable load (s8) from @_ZN10proc_macro6bridge6server27ALREADY_RUNNING_SAME_THREAD7__getit5__KEY17hadc6be6d27cb5446E, !noalias !735, !range !734); library/core/src/option.rs:630:9 @[ library/std/src/thread/local.rs:802:22 @[ library/std/src/thread/local.rs:969:23 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ] ] ]
  JCC_1 %bb.2, 5, implicit $eflags, debug-location !743; library/std/src/thread/local.rs:969:17 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  JMP_1 %bb.1, debug-location !743; library/std/src/thread/local.rs:969:17 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]

bb.1 (%ir-block.4):
; predecessors: %bb.0
  successors: %bb.2(0x80000000); %bb.2(100.00%)

  ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  TLS_addr64 $noreg, 1, $noreg, target-flags(x86-tlsgd) @_ZN10proc_macro6bridge6server27ALREADY_RUNNING_SAME_THREAD7__getit5__KEY17hadc6be6d27cb5446E, $noreg, implicit-def $rax, implicit-def dead $rcx, implicit-def dead $rdx, implicit-def dead $rsi, implicit-def dead $rdi, implicit-def dead $r8, implicit-def dead $r9, implicit-def dead $r10, implicit-def dead $r11, implicit-def dead $fp0, implicit-def dead $fp1, implicit-def dead $fp2, implicit-def dead $fp3, implicit-def dead $fp4, implicit-def dead $fp5, implicit-def dead $fp6, implicit-def dead $fp7, implicit-def dead $st0, implicit-def dead $st1, implicit-def dead $st2, implicit-def dead $st3, implicit-def dead $st4, implicit-def dead $st5, implicit-def dead $st6, implicit-def dead $st7, implicit-def dead $mm0, implicit-def dead $mm1, implicit-def dead $mm2, implicit-def dead $mm3, implicit-def dead $mm4, implicit-def dead $mm5, implicit-def dead $mm6, implicit-def dead $mm7, implicit-def dead $xmm0, implicit-def dead $xmm1, implicit-def dead $xmm2, implicit-def dead $xmm3, implicit-def dead $xmm4, implicit-def dead $xmm5, implicit-def dead $xmm6, implicit-def dead $xmm7, implicit-def dead $xmm8, implicit-def dead $xmm9, implicit-def dead $xmm10, implicit-def dead $xmm11, implicit-def dead $xmm12, implicit-def dead $xmm13, implicit-def dead $xmm14, implicit-def dead $xmm15, implicit-def dead $eflags, implicit-def dead $df, implicit $rsp, implicit $ssp, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  ADJCALLSTACKUP64 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  %4:gr64 = COPY $rax, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  %5:gr32 = MOV32r0 implicit-def dead $eflags
  %6:gr64 = SUBREG_TO_REG 0, killed %5:gr32, %subreg.sub_32bit
  $rdi = COPY %4:gr64, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  $rsi = COPY %6:gr64, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  CALL64pcrel32 @"_ZN3std6thread5local4fast12Key$LT$T$GT$14try_initialize17h0ec110b6f6a5f822E.llvm.13792208312489416292", <regmask $bh $bl $bp $bph $bpl $bx $ebp $ebx $hbp $hbx $rbp $rbx $r12 $r13 $r14 $r15 $r12b $r13b $r14b $r15b $r12bh $r13bh $r14bh $r15bh $r12d $r13d $r14d $r15d $r12w $r13w $r14w $r15w $r12wh and 3 more...>, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp, implicit-def $rax, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  %7:gr64 = COPY $rax, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  %0:gr64 = COPY %7:gr64, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]

bb.2 (%ir-block.6):
; predecessors: %bb.0, %bb.1
  successors: %bb.3(0x7ffff800), %bb.4(0x00000800); %bb.3(100.00%), %bb.4(0.00%)

  %1:gr64 = PHI %2:gr64, %bb.0, %0:gr64, %bb.1, debug-location !747; library/std/src/thread/local.rs:0 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
  TEST8mi %1:gr64, 1, $noreg, 0, $noreg, 1, implicit-def $eflags, debug-location !780 :: (load (s8) from %ir.7, !alias.scope !762, !noalias !745); library/proc_macro/src/bridge/server.rs:165:9
  MOV8mi %1:gr64, 1, $noreg, 0, $noreg, 1, debug-location !773 :: (store (s8) into %ir.7, !alias.scope !762, !noalias !745); library/core/src/ptr/mod.rs:1336:9 @[ library/core/src/mem/mod.rs:918:9 @[ library/core/src/cell.rs:413:9 @[ library/std/src/thread/local.rs:603:26 @[ library/std/src/thread/local.rs:446:16 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ] ] ]
  JCC_1 %bb.4, 5, implicit $eflags, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9
  JMP_1 %bb.3, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9

bb.3 (%ir-block.11):
; predecessors: %bb.2

  RET 0, debug-location !782; library/proc_macro/src/bridge/server.rs:170:6

bb.4 (%ir-block.12):
; predecessors: %bb.2

  LIFETIME_START %stack.0, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9
  %8:gr64 = LEA64r $rip, 1, $noreg, @anon.e76a1d14bfc7470edb601802a0a9c410.56, $noreg, debug-location !783; library/core/src/fmt/mod.rs:398:9 @[ library/proc_macro/src/bridge/server.rs:165:9 ]
  MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed %8:gr64, debug-location !783 :: (store (s64) into %ir.1, !alias.scope !785, !noalias !788); library/core/src/fmt/mod.rs:398:9 @[ library/proc_macro/src/bridge/server.rs:165:9 ]
  MOV64mi32 %stack.0, 1, $noreg, 8, $noreg, 1, debug-location !783 :: (store (s64) into %ir.13, !alias.scope !785, !noalias !788); library/core/src/fmt/mod.rs:398:9 @[ library/proc_macro/src/bridge/server.rs:165:9 ]
  MOV64mi32 %stack.0, 1, $noreg, 16, $noreg, 0, debug-location !783 :: (store (s64) into %ir.14, !alias.scope !785, !noalias !788); library/core/src/fmt/mod.rs:398:9 @[ library/proc_macro/src/bridge/server.rs:165:9 ]
  %9:gr64 = LEA64r $rip, 1, $noreg, @anon.e76a1d14bfc7470edb601802a0a9c410.4, $noreg, debug-location !783; library/core/src/fmt/mod.rs:398:9 @[ library/proc_macro/src/bridge/server.rs:165:9 ]
  MOV64mr %stack.0, 1, $noreg, 32, $noreg, killed %9:gr64, debug-location !783 :: (store (s64) into %ir.15, !alias.scope !785, !noalias !788); library/core/src/fmt/mod.rs:398:9 @[ library/proc_macro/src/bridge/server.rs:165:9 ]
  MOV64mi32 %stack.0, 1, $noreg, 40, $noreg, 0, debug-location !783 :: (store (s64) into %ir.16, !alias.scope !785, !noalias !788); library/core/src/fmt/mod.rs:398:9 @[ library/proc_macro/src/bridge/server.rs:165:9 ]
  ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9
  %10:gr64 = LEA64r $rip, 1, $noreg, @anon.e76a1d14bfc7470edb601802a0a9c410.58, $noreg, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9
  %11:gr64 = LEA64r %stack.0, 1, $noreg, 0, $noreg
  $rdi = COPY %11:gr64, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9
  $rsi = COPY %10:gr64, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9
  CALL64m $rip, 1, $noreg, target-flags(x86-gotpcrel) @_ZN4core9panicking9panic_fmt17h54a81d5809e2c881E, $noreg, <regmask $bh $bl $bp $bph $bpl $bx $ebp $ebx $hbp $hbx $rbp $rbx $r12 $r13 $r14 $r15 $r12b $r13b $r14b $r15b $r12bh $r13bh $r14bh $r15bh $r12d $r13d $r14d $r15d $r12w $r13w $r14w $r15w $r12wh and 3 more...>, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp, debug-location !780 :: (load (s64) from got); library/proc_macro/src/bridge/server.rs:165:9
  ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !780; library/proc_macro/src/bridge/server.rs:165:9
  TRAP debug-location !780; library/proc_macro/src/bridge/server.rs:165:9

# End machine code for function _ZN10proc_macro6bridge6server22RunningSameThreadGuard3new17hd07da82ffb49fc2aE.

*** Bad machine code: FrameSetup is after another FrameSetup ***
- function:    _ZN10proc_macro6bridge6server22RunningSameThreadGuard3new17hd07da82ffb49fc2aE
- basic block: %bb.1  (0x7f294866f2e0)
- instruction: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def $rsp, implicit-def $eflags, implicit-def $ssp, implicit $rsp, implicit $ssp, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]

*** Bad machine code: FrameDestroy is not after a FrameSetup ***
- function:    _ZN10proc_macro6bridge6server22RunningSameThreadGuard3new17hd07da82ffb49fc2aE
- basic block: %bb.1  (0x7f294866f2e0)
- instruction: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !744; library/std/src/thread/local.rs:971:29 @[ library/std/src/thread/local.rs:346:21 @[ library/std/src/thread/local.rs:445:32 @[ library/std/src/thread/local.rs:422:9 @[ library/std/src/thread/local.rs:603:9 @[ library/proc_macro/src/bridge/server.rs:164:31 ] ] ] ] ]
LLVM ERROR: Found 2 machine code errors.

Did not run successfully: exit status: 101
"/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "--crate-name" "proc_macro" "--edition=2021" "library/proc_macro/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts,future-incompat" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "debuginfo=1" "-C" "debug-assertions=on" "-Zunstable-options" "--check-cfg" "names()" "--check-cfg" "values()" "-C" "metadata=de3ffe529f393522" "-C" "extra-filename=-de3ffe529f393522" "--out-dir" "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps" "--target" "x86_64-unknown-linux-gnu" "-L" "dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/release/deps" "--extern" "core=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-05d65ceee8b68e1f.rmeta" "--extern" "std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.so" "--extern" "std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.rlib" "-Csymbol-mangling-version=legacy" "-Zunstable-options" "-Zunstable-options" "--check-cfg=values(bootstrap)" "--check-cfg=values(stdarch_intel_sde)" "--check-cfg=values(no_fp_fmt_parse)" "--check-cfg=values(no_global_oom_handling)" "--check-cfg=values(no_rc)" "--check-cfg=values(no_sync)" "--check-cfg=values(freebsd12)" "--check-cfg=values(backtrace_in_libstd)" "--check-cfg=values(target_env,\"libnx\")" "--check-cfg=values(target_os,\"watchos\")" "--check-cfg=values(target_arch,\"asmjs\",\"spirv\",\"nvptx\",\"nvptx64\",\"le32\",\"xtensa\")" "--check-cfg=values(dont_compile_me)" "--check-cfg=values(rustix_use_libc)" "-Zmacro-backtrace" "-Clink-args=-Wl,-z,origin" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Csplit-debuginfo=off" "-Zsave-analysis" "-Cprefer-dynamic" "-Cembed-bitcode=yes" "-Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" "-Z" "binary-dep-depinfo" "-L" "native=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-1dd36b1385d26063/out" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "--sysroot" "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1" "-Z" "force-unstable-if-unmarked"
-------------
error: could not compile `proc_macro`

Caused by:
  process didn't exit successfully: `CARGO=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/bin/cargo CARGO_CRATE_NAME=proc_macro CARGO_MANIFEST_DIR=/home/matthias/vcs/github/rust_debug_assertions/library/proc_macro CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=proc_macro CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/release/deps:/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/lib' /home/matthias/.cargo/bin/sccache /home/matthias/vcs/github/rust_debug_assertions/build/bootstrap/debug/rustc --crate-name proc_macro --edition=2021 library/proc_macro/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=1 -C debug-assertions=on -Zunstable-options --check-cfg 'names()' --check-cfg 'values()' -C metadata=de3ffe529f393522 -C extra-filename=-de3ffe529f393522 --out-dir /home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern core=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-05d65ceee8b68e1f.rmeta --extern std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.so --extern std=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libstd-56dc346069f0fc86.rlib -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_os,"watchos")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","nvptx64","le32","xtensa")' '--check-cfg=values(dont_compile_me)' '--check-cfg=values(rustix_use_libc)' -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Csplit-debuginfo=off -Zsave-analysis -Cprefer-dynamic -Cembed-bitcode=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo -L native=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-1dd36b1385d26063/out` (exit status: 101)
command did not execute successfully: "/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zcheck-cfg=names,values,output" "-Zbinary-dep-depinfo" "-j" "1" "-v" "-v" "-v" "-v" "-v" "-v" "-v" "--release" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/home/matthias/vcs/github/rust_debug_assertions/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
Traceback (most recent call last):
  File "/home/matthias/vcs/github/rust_debug_assertions/./x.py", line 28, in <module>
    bootstrap.main()
  File "/home/matthias/vcs/github/rust_debug_assertions/src/bootstrap/bootstrap.py", line 936, in main
    bootstrap(help_triggered)
  File "/home/matthias/vcs/github/rust_debug_assertions/src/bootstrap/bootstrap.py", line 922, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/home/matthias/vcs/github/rust_debug_assertions/src/bootstrap/bootstrap.py", line 166, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /home/matthias/vcs/github/rust_debug_assertions/build/bootstrap/debug/bootstrap build -j 1 -vvvvvvv

@matthiaskrgr matthiaskrgr added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. C-bug Category: This is a bug. requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way labels Nov 8, 2022
@TimNN
Copy link
Contributor

TimNN commented Nov 11, 2022

I've been looking at this a bit, it does reproduce with:

[profile.release.package.proc_macro]
opt-level = 0
codegen-units = 1

(This issue caught my interest because before https://reviews.llvm.org/D133036 was rolled back, it caused rustc to crash with a SIGILL in proc_macro (though this might also have been an issue with the patch and in general may be entirely unrelated here) when compiled at LLVM HEAD with that patch).

The error from the first comment fails in RunningSameThreadGuard::new, I'm seeing failures related to BRIDGE_STATE. One thing that both of these have in common is that they are / use thread_local!, which seems suspicious.

@TimNN
Copy link
Contributor

TimNN commented Nov 11, 2022

This Rust code reproduces the issue:

thread_local! {
    static FOO: u32 = 0;
}

I'm having trouble reproing with llc, probably because the TLS configurations used by rustc and llc are different: The generated LLVM IR is basically identical (except that one function is define hidden and the other define internal), but the first Machine code is different.

llc produces: %4:gr64 = MOV64rm $noreg, 1, $noreg, 0, $fs :: (load (s64) from `ptr addrspace(257) null`, addrspace 257)

rustc produces: TLS_base_addr64 $noreg, 1, $noreg, target-flags(x86-tlsld) @_ZN5repro3FOO7__getit5__KEY17h8a371060d0f5b551E, $noreg, implicit-def $rax, implicit-def dead $rcx, <lots more implicit-def dead regs>, implicit $rsp, implicit $ssp

edit: found the missing piece, the llc invocation was missing -relocation-model=pic.

@TimNN
Copy link
Contributor

TimNN commented Nov 11, 2022

Minified, crashes when compiled with llc -relocation-model=pic min.ll:

; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "repro.dba56e2e-cgu.0"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@_ZN5repro3FOO7__getit5__KEY17h8a371060d0f5b551E = external thread_local global <{ [4 x i8], [4 x i8], [1 x i8], [3 x i8] }>, align 4

declare ptr @"_ZN3std6thread5local4fast12Key$LT$T$GT$3get17h336c607071ef2f69E"(ptr, ptr) unnamed_addr #0

define hidden ptr @_ZN5repro3FOO7__getit17hcc9532ca2598edd1E(ptr %init) unnamed_addr #0 {
start:
  %0 = call align 4 ptr @"_ZN3std6thread5local4fast12Key$LT$T$GT$3get17h336c607071ef2f69E"(ptr align 4 @_ZN5repro3FOO7__getit5__KEY17h8a371060d0f5b551E, ptr align 4 undef)
  unreachable
}

attributes #0 = { "target-cpu"="x86-64" }

!llvm.module.flags = !{!0}

!0 = !{i32 2, !"RtLibUseGOT", i32 1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way 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

2 participants