Skip to content

f16/u128 and f16/i128 casts fail to link on macos #150389

@npmccallum

Description

@npmccallum

I tried this code:

1000u128 as f16

I expected to see this happen: successfully compiled and linked.

Instead, this happened: compilation succeeded, but linking failed:

  = note: Undefined symbols for architecture arm64:
            "___floattihf", referenced from:
                __RNvCs5thp3V6xHJg_12f16_i128_bug4main in f16_i128_bug-51851c505ee7ccf3.bzqm8wsrkqjhrmepcg5kajmyx.07dhato.rcgu.o
            "___floatuntihf", referenced from:
                __RNvCs5thp3V6xHJg_12f16_i128_bug4main in f16_i128_bug-51851c505ee7ccf3.bzqm8wsrkqjhrmepcg5kajmyx.07dhato.rcgu.o
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

See a reproducer here:

https://github.com/npmccallum/f16-i128-bug/

With a failed GitHub Actions run here:

https://github.com/npmccallum/f16-i128-bug/actions/runs/20518578014

This only fails on macOS, either aarch64 or x86_64.

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (fabece9e9 2025-12-25)
binary: rustc
commit-hash: fabece9e9491d0a3c3655dba488881968b7c5f7a
commit-date: 2025-12-25
host: aarch64-apple-darwin
release: 1.94.0-nightly
LLVM version: 21.1.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-compiler-builtinsArea: compiler-builtins (https://github.com/rust-lang/compiler-builtins)C-bugCategory: This is a bug.F-f16_and_f128`#![feature(f16)]`, `#![feature(f128)]`O-appleOperating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions