davide added a comment. If you take my example, and you pass `-target x86_64-pc-win32-macho`:
On clang-3.8, `TinkyWinky` is lowered to a GV with `weak_odr` linkage: $ clang++ 1.cpp -o - -emit-llvm -S -fms-extensions -target x86_64-pc-win32-macho ; ModuleID = '1.cpp' target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-windows-macho" @TinkyWinky = weak_odr global i32 0, align 4 !llvm.module.flags = !{!0} !llvm.ident = !{!1} !0 = !{i32 1, !"PIC Level", i32 2} !1 = !{!"clang version 3.8.0 (tags/RELEASE_380/final)"} On clang-5.0 (trunk, release+assert), the compiler just crashes :( $ ../clang++ 1.cpp -o - -emit-llvm -S -fms-extensions -target x86_64-pc-win32-macho clang-5.0: ../tools/clang/lib/CodeGen/CodeGenModule.cpp:479: void clang::CodeGen::CodeGenModule::Release(): Assertion `(LangOpts.ShortWChar || llvm::TargetLibraryInfoImpl::getTarget WCharSize(Target.getTriple()) == Target.getWCharWidth() / 8) && "LLVM wchar_t size out of sync"' failed. #0 0x000000000206f67a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/davide/work/llvm/build-release/bin/clang-5.0+0x206f67a) #1 0x000000000206d46e llvm::sys::RunSignalHandlers() (/home/davide/work/llvm/build-release/bin/clang-5.0+0x206d46e) #2 0x000000000206d5bc SignalHandler(int) (/home/davide/work/llvm/build-release/bin/clang-5.0+0x206d5bc) #3 0x00007f72dc473c30 __restore_rt (/lib64/libpthread.so.0+0x10c30) #4 0x00007f72dafdf765 __GI_raise (/lib64/libc.so.6+0x34765) #5 0x00007f72dafe136a __GI_abort (/lib64/libc.so.6+0x3636a) #6 0x00007f72dafd7f97 __assert_fail_base (/lib64/libc.so.6+0x2cf97) #7 0x00007f72dafd8042 (/lib64/libc.so.6+0x2d042) #8 0x00000000022cab88 clang::CodeGen::CodeGenModule::Release() (/home/davide/work/llvm/build-release/bin/clang-5.0+0x22cab88) #9 0x00000000028fbc77 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) (/home/davide/work/llvm/build-release/bin/clang-5.0+0x28fbc77) #10 0x00000000028fa965 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/davide/work/llvm/build-release/bin/clang-5.0+0x28fa965) #11 0x0000000002ccdf38 clang::ParseAST(clang::Sema&, bool, bool) (/home/davide/work/llvm/build-release/bin/clang-5.0+0x2ccdf38) #12 0x00000000028f9bbc clang::CodeGenAction::ExecuteAction() (/home/davide/work/llvm/build-release/bin/clang-5.0+0x28f9bbc) #13 0x00000000025bae0e clang::FrontendAction::Execute() (/home/davide/work/llvm/build-release/bin/clang-5.0+0x25bae0e) #14 0x000000000258c746 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/davide/work/llvm/build-release/bin/clang-5.0+0x258c746) #15 0x000000000264ac7b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/davide/work/llvm/build-release/bin/clang-5.0+0x264ac7b) #16 0x0000000000aff078 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/davide/work/llvm/build-release/bin/clang-5.0+0xaff078) #17 0x0000000000a92775 main (/home/davide/work/llvm/build-release/bin/clang-5.0+0xa92775) #18 0x00007f72dafcb731 __libc_start_main (/lib64/libc.so.6+0x20731) #19 0x0000000000afb7e9 _start (/home/davide/work/llvm/build-release/bin/clang-5.0+0xafb7e9) Stack dump: 0. Program arguments: /home/davide/work/llvm/build-release/bin/clang-5.0 -cc1 -triple x86_64-pc-windows-macho -emit-llvm -disable-free -main-file-name 1.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-f ile /home/davide/work/llvm/build-release/bin/decl/-.gcno -resource-dir /home/davide/work/llvm/build-release/lib/clang/5.0.0 -internal-isystem /home/davide/work/llvm/build-release/li b/clang/5.0.0/include -fdeprecated-macro -fdebug-compilation-dir /home/davide/work/llvm/build-release/bin/decl -ferror-limit 19 -fmessage-length 181 -fms-extensions -fms-compatibili ty -fms-compatibility-version=18 -std=c++11 -fno-threadsafe-statics -fdelayed-template-parsing -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-dia gnostics -o - -x c++ 1.cpp 1. <eof> parser at end of file 2. Per-file LLVM IR generation clang-5.0: error: unable to execute command: Aborted (core dumped) clang-5.0: error: clang frontend command failed due to signal (use -v to see invocation) clang version 5.0.0 (trunk 304592) (llvm/trunk 304594) Target: x86_64-pc-windows-macho https://reviews.llvm.org/D33852 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits