Closed NickHu closed 2 years ago
A bit of reducing could help here. ideally we want to be able to reproduce.
@rustbot label +O-wasm
tagging also @rustbot ping icebreakers-cleanup-crew
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good "Cleanup ICE-breaking candidate". In case it's useful, here are some instructions for tackling these sorts of bugs. Maybe take a look? Thanks! <3
cc @AminArria @ayazhafiz @camelid @chrissimpkins @contrun @elshize @h-michael @HallerPatrick @hdhoang @hellow554 @henryboisdequin @imtsuki @JamesPatrickGill @kanru @KarlK90 @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @shekohex @sinato @smmalis37 @steffahn @Stupremee @tamuhey @turboladen @woshilapin @yerke
Reduced: (must be compiled with --target=wasm32-unknown-unknown -C opt-level=3
, which can be done on playground by setting to "release" and clicking "WASM" instead of "Run")
fn explode<V, F, V2>(mut node_map: F) -> Option<()>
where
F: FnMut(V) -> Option<V2>,
{
let key = conjure();
node_map(key)?;
None
}
pub struct Layout<const N: usize>;
impl<const N: usize> Layout<N> {
pub fn new() {
for i in 0..N {
let node_map = |key: [(); N]| -> Option<[f32; N]> {
key[i];
None
};
explode(node_map);
}
}
}
fn conjure<T>() -> T {
unimplemented!()
}
pub fn main() {
Layout::<0>::new();
}
searched nightlies: from nightly-2022-01-13 to nightly-2022-05-03 regressed nightly: nightly-2022-03-11 searched commit range: https://github.com/rust-lang/rust/compare/458262b1315e0de7be940fe95e111bb045e4a2a4...5f4e0677190b82e61dc507e3e72caf89da8e5e28 regressed commit: https://github.com/rust-lang/rust/commit/282778aee26166754315815552bae454fc968960
This did indeed regress in the LLVM bump (#94764).
@rustbot label I-crash A-llvm
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.
Great work @SNCPlay42 thanks!
@rustbot label -I-prioritize +P-high -ICEBreaker-Cleanup-Crew
Looks like https://reviews.llvm.org/D119854 is the change where it starts failing.
Adding -C llvm-args="-switch-range-to-icmp=1"
does seem to work around the crash.
cc @nikic
IR: https://gist.github.com/nikic/66478e84510d35b763a6b99a2aefa508 Running this through opt -O3
crashes with LLVM 14 but works fine on main, so this was apparently already fixed in the meantime.
Bisect points to https://github.com/llvm/llvm-project/commit/857c612d899f271402470d4026d2e3be1dce53a4, which probably just hides the problem.
Ah no, I misread. That does look like the actual fix for the issue.
Filed backport issue: https://github.com/llvm/llvm-project/issues/55304
Apologies for the noise, but did this fix make its way into 1.61? I'm still getting similar issues there.
Code
I tried this code:
I expected to see this happen: successful compilation
Instead, this happened:
Version it worked on
It most recently worked on (
nix build github:homotopy-io/homotopy-rs?rev=5ba852c72a3e552d3668233a14fd9769dea0797e
):Version with regression
rustc --version --verbose
:Other information
We've determined that https://github.com/homotopy-io/homotopy-rs/blob/0cc608109c699f7fac2e7979f2f0d440ac4ac786/homotopy-web/src/app/workspace.rs#L101 is the culprit; either removing that line or replacing
<0>
with<1>
both fix the compiler crashing (although this does not produce the code we want).This looks like it's possibly related to the LLVM version.
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged