<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/69398>69398</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Program using `ceil` crashes after being compiled with `-static -flto` on Fedora and Manjaro
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tsoj
      </td>
    </tr>
</table>

<pre>
    When compiling and running the following example on Fedora with `clang -static -flto ./main.c -lm && ./a.out`, it crashes.

**main.c**
```c
#include <math.h>

int main()
{
    int i = 0;
    double d = ceil(i);
}

```

**Back trace**
```c
Program received signal SIGSEGV, Segmentation fault.
0x000000000041011d in __strlen_avx2 ()
(gdb) bt
#0  0x000000000041011d in __strlen_avx2 ()
#1 0x00000000004722d5 in get_cie_encoding ()
#2  0x0000000000472c18 in classify_object_over_fdes ()
#3  0x00000000004738af in __register_frame_info ()
#4  0x0000000000401781 in frame_dummy ()
#5 0x00007fffffffe190 in ?? ()
#6  0x00000000004032d9 in __libc_start_main_impl ()
Backtrace stopped: frame did not save the PC
```

**Clang version**

On Fedora, I installed clang with `dnf install clang glibc-static`.
```
$ clang -v
clang version 16.0.6 (Fedora 16.0.6-3.fc38)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/13
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-redhat-linux/13
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
```

The same issue also happens on Manjaro  (clang 16.0.6). 
I have not tested newer versions or on different systems.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU-P27gP_TTKhYghS4ljH3KYZuqihx9-BabYPRqyRNvqylIgyZmZb7-Q_0w7adHFHtYwHEfkox-pR1GEoHuLeCbHD-T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