[clang] Reland "[clang] Lower modf builtin using `llvm.modf` intrinsic" (PR #129885)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 10 08:35:39 PDT 2025


zmodem wrote:

This broke code using `modff` on 32-bit x86 Windows, where the runtime library doesn't provide any `modff` symbol, rather it's implemented inline in `math.h` (which calls `modf`):

```
>type \src\temp\a.c
#include <math.h>
#include <stdio.h>

float foo(float f) {
  float i;
  return modff(f, &i);
}

int main() {
        printf("%f\n", foo(3.14));
        return 0;
}

>build\bin\clang-cl -m32 \src\temp\a.c
a-4184ec.obj : error LNK2019: unresolved external symbol _modff referenced in function _foo
a.exe : fatal error LNK1120: 1 unresolved externals
clang-cl: error: linker command failed with exit code 1120 (use -v to see invocation)
```

(See also https://godbolt.org/z/jvfe4zGTj)

I'll back this out for now to unbreak things.

https://github.com/llvm/llvm-project/pull/129885


More information about the cfe-commits mailing list