Skip to content

[browser][CoreCLR][R2R] Double Max/Min do not preserve selected NaN payload #134268

Description

@lewing

Description

The trimmed browser-wasm CoreCLR ReadyToRun library-test lane exposes four generic-math double.Max/double.Min cases where the selected NaN operand's sign/payload is not preserved. The assertion output renders both values as NaN, but the bitwise comparison detects that the result differs from the expected operand.

This resembles #133311, but that issue is explicitly scoped to Mono browser-wasm. This issue tracks the distinct CoreCLR ReadyToRun configuration so its quarantine and re-enable condition are independent.

Reproduction Steps

Run System.Runtime.Tests using browser-wasm CoreCLR with trimmed ReadyToRun images:

XHARNESS_COMMAND=test-browser ./dotnet.sh build /t:Test \
  src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj \
  /p:TargetOS=browser /p:TargetArchitecture=wasm /p:RuntimeFlavor=CoreCLR /p:Configuration=Release \
  /p:TestWasmReadyToRun=true /p:EnableAggressiveTrimming=true \
  /p:Scenario=WasmTestOnChrome /p:InstallChromeForTests=true

The affected member-data rows are the positive/negative NaN payload cases in MaxDouble and MinDouble from src/libraries/Common/tests/System/GenericMathTestMemberData.cs.

Expected behavior

double.Max and double.Min return the selected NaN operand with its sign and payload preserved, matching the generic-math test expectations.

Actual behavior

Four rows fail because the returned NaN has different bits from the expected NaN operand:

  • MaxDouble: positive NaN with -0.0
  • MaxDouble: -0.0 with negative NaN
  • MinDouble: positive NaN with -0.0
  • MinDouble: -0.0 with negative NaN

Regression?

Unknown. The new full trimmed ReadyToRun library sweep first exposed the behavior.

Known Workarounds

Temporarily omit only these four member-data rows when PlatformDetection.IsWasmReadyToRun is true.

Configuration

  • Runtime: CoreCLR
  • Target: browser-wasm
  • Mode: ReadyToRun with aggressive trimming
  • Browser: Chrome
  • Architecture: wasm32

Other information

Related Mono-specific issue: #133311.

Note

This issue was created by GitHub Copilot based on locally reproduced CI evidence.

Activity

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

    arch-wasmWebAssembly architecturearea-ReadyToRundisabled-testThe test is disabled in source code against the issue

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions