镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Wasm / R2R: crossgen2 assert in genCodeForShift on long shift with non-INT shift amount #129263

Closed

Description

@AndyAyersMS

Compiling src\tests\JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b53884\b53884.il
for Wasm R2R hits an assert in genCodeForShift:

src\coreclr\jit\codegenwasm.cpp:1820
Assertion failed 'treeNode->gtGetOp2()->TypeIs(TYP_INT)' in
'ILGEN_0x3c109d11:Method_0x52483fac(short,double,byte,sbyte,double):int'
during 'Generate code' (IL size 493; hash 0xde5c0090; FullOpts)

The asserting code handles a TYP_LONG shift / rotate and expects its
second operand (shift amount) to already be TYP_INT:

// codegenwasm.cpp, CodeGen::genCodeForShift
if (treeNode->TypeIs(TYP_LONG))
{
    assert(treeNode->gtGetOp2()->TypeIs(TYP_INT));
    // Zero-extend the shift amount to 64 bits for long shifts/rotates.
    GetEmitter()->emitIns(INS_i64_extend_u_i32);
}

For this test (a generated stress test full of shr.un on int64
locals/arrays) some shift's op2 doesn't reach codegen as TYP_INT,
so the assert fires and crossgen2 exits with -2147483645
(STATUS_BREAKPOINT). The test source includes:

.locals (int8[] local_0x0, unsigned int64 local_0x1, ...)
...
shr.un        ;; on unsigned int64 with various-typed shift amounts

This blocks the merged R2R image build for both Regression_6 (M11/M12
CLR-x86 tests) and Regression_7 (M09.5/M10 CLR-x86 tests). Because the
assert fires at R2R compile time, the runtime-side
DOTNET_ReadyToRunExcludeList workaround used in #128234 does not help.

Repro

.\build clr+libs -rc debug -c release -os browser
.\src\tests\build skipmanaged browser

;; put repo dotnet in path
set DOTNET_ROOT=<REPO_ROOT>\.dotnet
set PATH=<REPO_ROOT>\.dotnet;%PATH%

cd src\tests\JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b53884
dotnet msbuild /p:TargetArchitecture=wasm /p:TargetOS=browser /p:RuntimeFlavor=coreclr ^
  /p:BuildAsStandalone=true b53884.ilproj

set CORE_ROOT=<REPO_ROOT>\artifacts\tests\coreclr\browser.wasm.Debug\Tests\Core_Root
set DLL=<REPO_ROOT>\artifacts\tests\coreclr\browser.wasm.Debug\JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b53884\b53884\b53884.dll
set CG2DIR=<REPO_ROOT>\artifacts\bin\crossgen2_inbuild\wasm\Debug

dotnet %CG2DIR%\crossgen2.dll ^
  --targetos:windows --targetarch:wasm ^
  --jitpath %CG2DIR%\clrjit_universal_wasm_x64.dll ^
  --inputbubble ^
  -r:%CORE_ROOT%\*.dll ^
  -o:b53884.wasm ^
  --parallelism 1 ^
  %DLL%

Hit on wasm-eh-infra (and on any branch built on top of it, e.g. PR #129197).

Activity

  1. self-assigned this
    on Jun 10, 2026
  2. added
    arch-wasmWebAssembly architecture
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on Jun 10, 2026
  3. dotnet-policy-service commented on Jun 10, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
    See info in area-owners.md if you want to be subscribed.

  4. dotnet-policy-service commented on Jun 10, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  5. AndyAyersMS commented on Jun 10, 2026

    @AndyAyersMS
    MemberAuthor

    @adamperlin perhaps you can take this one?

    I don't know if it repros in current main or requires some of the PRs in flight to land first.

  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Jun 10, 2026
  7. adamperlin commented on Jun 10, 2026

    @adamperlin
    Contributor

    I am happy to take this one! If it doesn't repro in current main I'll wait for the PRs that are in-flight!

  8. added a commit that references this issue on Jun 15, 2026
    dabcb41
  9. added a commit that references this issue on Jul 15, 2026
    3fac719
  10. locked and limited conversation to collaborators on Jul 16, 2026
  11. added a commit that references this issue on Jul 22, 2026
    b236861
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions