Skip to content

Cranelift: panic calculating timing total #12692

Closed

Description

@ConradIrwin

Steps to Reproduce

Unclear, this is a crash we saw in our telemetry at https://zed.dev. I see that there's a debug_assert that the passes should be in the right order, but in a release build the panic happens later.

overflow when subtracting durations

core::time::impl$3::sub (time.rs:1164)
cranelift_codegen::timing::enabled::impl$0::total::closure$0 (timing.rs:174)
core::ops::function::impls::impl$4::call_once (function.rs:310)
core::option::Option::map (option.rs:1165)
core::iter::adapters::map::impl$2::next (map.rs:107)
core::time::impl$10::sum (time.rs:1259)
core::iter::traits::iterator::Iterator::sum (iterator.rs:3581)
cranelift_codegen::timing::enabled::PassTimes::total (timing.rs:174)
wasmtime_cranelift::compiler::impl$3::compile_function (compiler.rs:284)
wasmtime::compile::impl$4::collect_inputs_in_translations::closure$0 (compile.rs:490)
core::ops::function::FnOnce::call_once<T> (function.rs:250)
alloc::boxed::impl$31::call_once (boxed.rs:2206)
wasmtime::compile::compile_required_builtins::closure$1 (compile.rs:610)
wasmtime::engine::impl$2::run_maybe_parallel::closure$0 (engine.rs:183)
core::ops::function::impls::impl$1::call_mut (function.rs:274)
core::ops::function::impls::impl$4::call_once (function.rs:310)
core::option::Option::map (option.rs:1165)
core::iter::adapters::map::impl$2::next (map.rs:107)
rayon::iter::plumbing::Folder::consume_iter (mod.rs:173)

Expected Results

No panic

Actual Results

Panic

Versions and Environment

Cranelift version or commit: 33.0.2

Operating system: Windows

Architecture: x86

Extra Info

Anything else you'd like to add?

Activity

  1. added
    bugIncorrect behavior in the current implementation that needs fixing
    craneliftIssues related to the Cranelift code generator
    on Feb 27, 2026
  2. fitzgen commented on Mar 26, 2026

    @fitzgen
    Member

    Fixed in #12709 I believe; reopen if not.

  3. benbrandt commented on May 4, 2026

    @benbrandt
    Member

    We are seeing this on the v36 LTS branch. Any chance this could be backported?

  4. alexcrichton commented on May 4, 2026

    @alexcrichton
    Member

    You can find more docs on backporting here, but tl;dr; yes this is fine to backport. Backports for bug fixes (as opposed to security fixes) are on a best-effort basis and one that we accept external PRs for. @benbrandt would you be up for sending a PR to the release-36.0.0 branch?

  5. benbrandt commented on May 5, 2026

    @benbrandt
    Member

    Sure thing! Made it here: #13273
    Let me know if you need anything else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixingcraneliftIssues related to the Cranelift code generator

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions