I did include -stdlib=libstdc++ in the command line. Clang does generate a
.bc file, but when I run the .exe file, the program crashes immediately.
Windows gives the following error: "Your application has stopped working".
I think it has something to do with libstdc++-6.dll.
If you’re using mingw, make sure you’re using the right OS in the triple. This is usually a flag like --target=i686-pc-mingw32. clang may be defaulting to an OS of win32, which has a slightly different C ABI w.r.t. passing records by value, bitfields, and other little things.
You should also try to get a stack trace with gdb to get more information.