Skip to content

Driver silently ignores documented --emit-llvm and writes an executable as IR #1097

Closed

Description

@ehartford

docs/deep-debugging-tools.md:60 directs agents to use --emit-llvm. There is no implementation of that flag in src. DriverOptions.w:486 recognizes --emit-c and --emit-obj, but an unknown emission flag is silently ignored.

Repro on wo-c4 at b65817c:

with build test/behavior/borrowed_str_binding_preserves_source.w -O1 --emit-llvm -o /tmp/with-requested-ir.ll
file /tmp/with-requested-ir.ll

Actual: success and a Mach-O executable named .ll, not LLVM IR. The same happened for --emit-ir. This silently falsifies the requested debug artifact. The observed artifact in this hunt is out/c4-validation/regex-lifetime-llvm.ll (Mach-O arm64), compiled from a minimal std.regex consumer.

Expected: either implement the documented LLVM IR output or reject the unknown flag with a nonzero diagnostic. Keep the route documentation accurate. Until fixed, the hunt uses LLDB disassembly; no executable file is treated as IR evidence.

Activity

  1. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced. --emit-llvm is still accepted and ignored.

    $ with build main.w -O1 --emit-llvm -o out.ll
    rc=0
    $ file out.ll
    out.ll: Mach-O 64-bit executable arm64
    

    with build accepts any unknown flag silently (see #1048), while with check refuses one.

    pre-release: a documented-looking flag silently produces the wrong artifact; refusing unknown build flags is small.

  2. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25: the separate finding noted above is filed as #2634.

  3. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Fixed by be37e17 (#2639): with build, with test and with analyze now refuse an option they do not know, as check, ir and run do. with build x.w --emit-llvm -o x.ll exits 2 with error: unknown option \--emit-llvm` for `with build`instead of writing an executable to x.ll. Regression test: deep-debug-tool-tests (build.wdeep_debug_unknown_flag_refused`).

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions