Skip to content

Windows C model disagrees with itself on long double: TargetSpec says f64, the windows-gnu parse says 80-bit #2771

Closed

Description

@ehartford

Two owners give different answers for the same fact on Windows:

  • src/TargetSpec.w:93 c_long_double_is_double: true for every Windows target (os == "Windows"). This feeds ci_c_long_double_representable (src/CImport.w:615), so c_import treats a declaration passing long double as importable with c_longdouble = f64.
  • The C parse on a Windows host runs under the x86_64-w64-windows-gnu model (the SDK ships MinGW headers/libc; build.w:680), where clang reports sizeof(long double) == 16 (80-bit x87). The bridge (src/compiler/ClangBridge.w:1075) therefore marks the type unsupported, and the migrator refuses a function over it.

For c_import this is an ABI hazard in the D51 sense: a MinGW C function taking long double would be imported as taking f64 while the C side passes an 80-bit value. For the migrator the refusal is correct under its model.

§16.1 is model-relative ("where C's long double is wider than a double, a declaration that passes one is not imported") and does not itself name Windows. The question for a ruling: is the Windows C model MinGW (then TargetSpec's table is wrong for x86_64 Windows and c_longdouble declarations must not import there) or MSVC (then the parse triple and the SDK's header world are the mismatch)?

Evidence: on win10, with cc -E and migrate of long double p4(const char *s) { return strtold(s, 0); } -> untranslatable function 'p4': unsupported type (long double is wider than a double on this target...). Found during #809; that work makes the strtoll-family fixture ask for strtold only where the model has the type.

Activity

  1. added 4 commits that reference this issue on Oct 28, 2026
  2. added a commit that references this issue on Oct 29, 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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions