Skip to content

Lower preserved asm input expressions without macOS time-provider panics #491

Closed

Description

@LunaStev

Confirmed PR regression / merge blocker

PR #486 head 6fb6ed7 preserves casts in asm operands instead of silently discarding their tokens. The standalone asm LLVM lowering path still uses a restricted, duplicated operand evaluator, so valid existing macOS time-provider code now fails during code generation.

Native macOS ARM64 CI checked all 248 corpus sources successfully, then ran 24/26 std examples successfully. examples/std/time.wave and examples/std/datetime_roundtrip.wave fail with:

E9001: compiler internal error during code generation
Unsupported asm operand expression: Cast { expr: Variable("info"), target_type: Int(64) }
compiler panic location: llvm/src/statement/asm.rs:557:14

Failing native build job. The native macOS ARM64 cases job also has one failure with the identical Cast { expr: Variable("info"), target_type: Int(64) } panic.

Reproduce without a macOS host

After building #486 with the AArch64 backend available:

target/release/wavec build examples/std/time.wave \
  --target aarch64-apple-darwin --emit=ir --out-dir /tmp/wave-macos-time

This reproduces the same Unsupported asm operand expression: Cast on Linux before linking, so contributors do not need a macOS SDK to start investigating.

Root-cause evidence

  • front/parser/src/parser/asm.rs now uses the common expression parser for operands.
  • llvm/src/statement/asm.rs::asm_operand_to_value accepts a limited set of AST shapes and rejects Cast.
  • That helper also parses integer operands as decimal only, bypassing the shared numeric conversion path.
  • The expression-asm path in llvm/src/expression/rvalue/asm.rs already evaluates inputs through the general expression generator; compare the two paths before adding another partial evaluator.

Acceptance

  • Standalone asm lowers the semantically accepted input expressions through typed expression codegen, including pointer-to-integer casts and radix literals.
  • Add cross-target regressions that emit IR/objects for the existing macOS time providers and focused asm input examples.
  • Preserve register-width coercion, signedness, constraint validation and side-effect evaluation order.
  • Both failing std examples pass on native macOS CI, and the Linux/std/ABI regressions remain green.
  • Do not remove the casts from std, resume parser token skipping or skip the failing examples.

This must be resolved before merging #486. It is not labeled a good first issue because it crosses typed expression lowering and asm register/ABI contracts.

Additional native evidence

The macOS amd64 build job also fails both time/datetime examples with the identical unsupported Cast panic. This is shared standalone asm lowering, not an ARM64-only defect. The ARM64 case failure is tests/cases/macos/arm64/test1.wave (122 passed / 1 failed).

Activity

  1. added
    bug
    help wanted
    critical
    cross-platform
    on Sep 7, 2026
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

    bugcriticalcross-platformhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions