Repository navigation
ICE: assertion failed: ptr::eq(context.tcx.gcx as *const _ as *const (), tcx.gcx as *const _ as *const ()), compiler/rustc_middle/src/ty/context/tls.rs #110564
Description
Activity
- addedC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Apr 19, 2023 This occurred after testing the change at commit 9c51cf7. This is also occurring only on our mac builder. So far only one instance.
- changed the title
[-]ICE while compiling the compiler[/-][+]ICE: assertion failed: ptr::eq(context.tcx.gcx as *const _ as *const (), tcx.gcx as *const _ as *const ()), compiler/rustc_middle/src/ty/context/tls.rs[/+]on Apr 20, 2023 - pinned this issue
on Apr 20, 2023 - unpinned this issue
on Apr 20, 2023 Are you able to consistently reproduce the issue, and only after that commit?
This is a sanity assertion that should never be hit. It implies that there are two global contexts in the compilation session, which makes no sense. It's entirely possible that stage2 rustc is getting miscompiled. Do you have any weird configs?
@Nashenas88 if you are hitting this reliably, can you apply this diff and post the new ICE message? I'd expect it to show the same numerical values for both pointers.
diff --git a/compiler/rustc_middle/src/ty/context/tls.rs b/compiler/rustc_middle/src/ty/context/tls.rs index fb0d909307e..f2a93ea7e25 100644 --- a/compiler/rustc_middle/src/ty/context/tls.rs +++ b/compiler/rustc_middle/src/ty/context/tls.rs @@ -126,7 +126,7 @@ pub fn with_related_context<'tcx, F, R>(tcx: TyCtxt<'tcx>, f: F) -> R assert!(ptr::eq( context.tcx.gcx as *const _ as *const (), tcx.gcx as *const _ as *const () - )); + ), "{:?} != {:?}", context.tcx.gcx as *const _, tcx.gcx as *const _); let context: &ImplicitCtxt<'_, '_> = unsafe { mem::transmute(context) };
@jyn514 @Nilstrieb unfortunately this hasn't reproduced.
Our config.toml is generated. It can be seen here: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8783352442962811473/+/u/generate_config.toml/raw_io.output_text
And these were the environment variables:
https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8783352442962811473/+/u/generate_environment/raw_io.output_text_environment_all those options look pretty reasonable; the only thing that stands out is that we don't test
lto = fat, but I'm not aware of it being broken.Why are you using fat LTO in the first place? Have you measured the performance impact (or binary size impact)? ThinLTO was measured to be faster: #103453
We were following #101403 and must've missed that that was using thin instead of fat, or just assumed fat would be faster. We can always switch to thin.
I wouldn't expect that to explain this assertion failure though, unless LLVM is just doing a memory corruption in rustc.EDIT: Oh, a miscompile in the LTO pipeline could certainly explain itStill though, I find it fairly alarming that there would be a miscompile in rustc using supported options.
Reacted by jyn and nora- addedA-LTOArea: Link-time optimization (LTO)Area: Link-time optimization (LTO)
on Feb 22, 2024 - addedE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleS-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.and removedE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
on Dec 2, 2024
Code
Something in the standard library. We caught this in our integration pipeline.
Meta
rustc --version --verbose:Error output
Link to full build output here.
Backtrace