ifstream destructor crash with unstable ABI

I've attached a simple example that can be compiled using `clang++ crash.cpp` and will segfault when ran on my x86-64 Linux machine.
The issue does not occur if compiled using optimizations. Presumably the destructor call gets optimized away.

I vendor libc++ using the unstable ABI, so commit 997d41cdec536a0b632505d9b0c4ab5dec5d7d12 <https://github.com/llvm/llvm-project/commit/997d41cdec536a0b632505d9b0c4ab5dec5d7d12&gt; seems suspect.

Has anyone seen this? Any ideas what's wrong?

crash.cpp (72 Bytes)

lldb.txt (1.01 KB)

I looked into this more and the issue seems to have been due to an incorrect relocation for the std::basic_ifstream when calling the destructor.

This seems to have been a bug in the X86FastISel fixed in this commit <https://github.com/llvm/llvm-project/commit/687b83ceabafe81970cd4639e7f0c89036402081&gt;\.