[cfe-dev] "#Include <iostream> or <string>" compile error

Reid Kleckner rnk at google.com
Wed Jul 1 10:06:29 PDT 2015


This looks like a problem in WinEHPrepare. Try disabling C++ exceptions.
See this bug for more info:
https://llvm.org/bugs/show_bug.cgi?id=22975

On Wed, Jul 1, 2015 at 3:13 AM, haifeng.qin <haifeng.qin at wellintech.com>
wrote:

> HI,
>
> *file*:  M:\OpenSource\LLVMTest\LLVMTest\main.cpp
> *code*:
>
> //#include <string>
> #include <iostream>
>
>
> int main(int argc, char **argv)
> {
> return 0;
> }
>
>
> *compile result*:
>
>
> M:\OpenSource\llvm-trunk\build\Debug\bin>clang++ -fuse-ld=lld -o M:\OpenSource\LLVMTest\LLVMTest\LLVMTest.exe M:\OpenSource\LLVMTest\LLVMTest\main.cpp -g
>
> Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file M:\OpenSource\llvm-trunk\include\llvm/Support/Casting.h, line 237
>
> 0x00000001413F7FBC (0x0000000000000016 0x000000008885E194 0x0000000000000023 0x000007FEDE6945D7), HandleAbort() + 0xC bytes(s), m:\opensource\llvm-trunk\lib\support\windows\signals.inc, line 289
>
> 0x000007FEDE78396F (0x0000000000000016 0x0000000000000000 0x0000000000B69A28 0xCCCCCCCCCCCCCCCC), raise() + 0x35F bytes(s)
>
> 0x000007FEDE792060 (0x0000000000B6A140 0x0000000000000240 0x000007FEDE858430 0x0000000145034600), abort() + 0x40 bytes(s)
>
> 0x000007FEDE77BF78 (0x0000000145034600 0x0000000145034570 0xCCCCCCCC000000ED 0xCCCCCCCCCCCCCCCC), _wassert() + 0x108 bytes(s)
>
> 0x000000013F96A985 (0x0000000003F38640 0x0000000000B6A8A8 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::cast<llvm::Instruction,llvm::Value>() + 0x55 bytes(s), m:\opensource\llvm-trunk\include\llvm\support\casting.h, line 237 + 0x37 byte(s)
>
> 0x0000000140B5DC21 (0x0000000004076260 0x0000000003F2B7A8 0x0000000000B6BF88 0xCCCCCCCCCCCCCCCC), `anonymous namespace'::WinEHPrepare::demoteValuesLiveAcrossHandlers() + 0x481 bytes(s), m:\opensource\llvm-trunk\lib\codegen\winehprepare.cpp, line 644 + 0xD byte(s)
>
> 0x0000000140B5AA77 (0x0000000004076260 0x0000000003F2B7A8 0x0000000000B6BF88 0xCCCCCCCCCCCCCCCC), `anonymous namespace'::WinEHPrepare::prepareExceptionHandlers(
>
> ) + 0x187 bytes(s), m:\opensource\llvm-trunk\lib\codegen\winehprepare.cpp, line715
>
> 0x0000000140B5A821 (0x0000000004076260 0x0000000003F2B7A8 0x0000000003F2B7A8 0xCCCCCCCC00000004), `anonymous namespace'::WinEHPrepare::runOnFunction() + 0x291 b
> ytes(s), m:\opensource\llvm-trunk\lib\codegen\winehprepare.cpp, line 393
>
> 0x0000000140C9460E (0x0000000002B556E0 0x0000000003F2B7A8 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::FPPassManager::runOnFunction() + 0x1AE bytes(s), m:\opensource\llvm-trunk\lib\ir\legacypassmanager.cpp, line 1520 + 0x37 byte(s)
>
> 0x0000000140C94835 (0x0000000002B556E0 0x000000000015F620 0x000000000015F620 0xCCCCCCCC00000005), llvm::FPPassManager::runOnModule() + 0xA5 bytes(s), m:\opensource\llvm-trunk\lib\ir\legacypassmanager.cpp, line 1540 + 0x1B byte(s)
>
> 0x0000000140C95C7C (0x0000000002C33110 0x000000000015F620 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), `anonymous namespace'::MPPassManager::runOnModule() + 0x31C bytes(s), m:\opensource\llvm-trunk\lib\ir\legacypassmanager.cpp, line 1596 + 0x40byte(s)
>
> 0x0000000140C96581 (0x00000000031D79E0 0x000000000015F620 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::legacy::PassManagerImpl::run() + 0x171 bytes(s), m:\opensource\llvm-trunk\lib\ir\legacypassmanager.cpp, line 1698 + 0x2D byte(s)
>
> 0x0000000140C8F6A6 (0x000000000403FE90 0x000000000015F620 0x00000000001110D0 0xCCCCCCCCCCCCCCCC), llvm::legacy::PassManager::run() + 0x36 bytes(s), m:\opensource\llvm-trunk\lib\ir\legacypassmanager.cpp, line 1730
>
> 0x0000000141C648D3 (0x0000000000B6C7C0 0x0000000000000005 0x00000000001110D0 0x00000000000FE330), `anonymous namespace'::EmitAssemblyHelper::EmitAssembly() + 0x443 bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\codegen\backendutil.cpp,line 653
>
> 0x0000000141C626FB (0x0000000000123650 0x0000000000104150 0x00000000000FE330 0x0000000000106940), clang::EmitBackendOutput() + 0x9B bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\codegen\backendutil.cpp, line 668
>
> 0x0000000141C3AF2B (0x0000000000161480 0x000000000014C6C0 0x000000000018A1C0 0xCCCCCCCCCCCCCC00), clang::BackendConsumer::HandleTranslationUnit() + 0x38B bytes(s), m:opensource\llvm-trunk\tools\clang\lib\codegen\codegenaction.cpp, line 183
>
> 0x00000001428E5EC8 (0x000000000018A1C0 0xCCCCCCCC00000000 0x0000000000000000 0xCCCCCCCCCCCCCCCC), clang::ParseAST() + 0x378 bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\parse\parseast.cpp, line 153
>
> 0x00000001417983DB (0x0000000000123CB0 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), clang::ASTFrontendAction::ExecuteAction() + 0x12B bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\frontend\frontendaction.cpp, line 538
>
> 0x0000000141C3634C (0x0000000000123CB0 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), clang::CodeGenAction::ExecuteAction() + 0x63C bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\codegen\codegenaction.cpp, line 741
>
> 0x0000000141797E87 (0x0000000000123CB0 0x00000000000FD970 0x0000000000110950 0xCCCCCCCCCCCCCCCC), clang::FrontendAction::Execute() + 0x97 bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\frontend\frontendaction.cpp, line 444
>
> 0x000000014173AA0D (0x00000000000FD970 0x0000000000123CB0 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), clang::CompilerInstance::ExecuteAction() + 0x38D bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\frontend\compilerinstance.cpp, line 819
>
> 0x00000001418EBC33 (0x00000000000FD970 0x0000000000123650 0x0000000000B6DF01 0x0000000000B6D4E0), clang::ExecuteCompilerInvocation() + 0x503 bytes(s), m:\opensource\llvm-trunk\tools\clang\lib\frontendtool\executecompilerinvocation.cpp, line 222 + 0x1D byte(s)
>
> 0x000000013F8BE710 (0x0000000000B6DCA0 0x0000000000118260 0x000000013F792270 0xCCCCCCCCCCCCCCCC), cc1_main() + 0x450 bytes(s), m:\opensource\llvm-trunk\tools\clang\tools\driver\cc1_main.cpp, line 112 + 0x12 byte(s)
>
> 0x000000013F8A6F1D (0x0000000000B6F5E0 0x0000000000B6F5F0 0x0000000000B6DDCC 0x0000000000B6E500), ExecuteCC1Tool() + 0xFD bytes(s), m:\opensource\llvm-trunk\tools\clang\tools\driver\driver.cpp, line 358 + 0x61 byte(s)
>
> 0x000000013F8A74E9 (0x000000010000003C 0x00000000000FBB10 0x0000000000000000 0x0000000143CB4E26), main() + 0x499 bytes(s), m:\opensource\llvm-trunk\tools\clang\tools\driver\driver.cpp, line 404 + 0x9D byte(s)
>
> 0x0000000143CB3A6D (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __tmainCRTStartup() + 0x19D bytes(s), f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c, line 626 + 0x19 byte(s)
>
> 0x0000000143CB3B9E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0xE bytes(s), f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c, line 466
>
> 0x0000000076E559ED (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0xD bytes(s)
>
> 0x0000000076F8C541 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
>
> clang++.exe: error: clang frontend command failed due to signal (use -v to see invocation)
> clang version 3.7.0 (trunk 240255)
> Target: x86_64-pc-windows-msvc
> Thread model: posix
> clang++.exe: note: diagnostic msg: PLEASE submit a bug report to
> http://llvm.org/bugs/
>  and include the crash backtrace, preprocessed source, and associated run script.
> clang++.exe: note: diagnostic msg:
> ********************
>
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
>
> clang++.exe: note: diagnostic msg: C:\Users\HAIFEN~1\AppData\Local\Temp\main-b94da6.cpp
>
> clang++.exe: note: diagnostic msg: C:\Users\HAIFEN~1\AppData\Local\Temp\main-b94da6.sh
> clang++.exe: note: diagnostic msg:
>
> ********************
>
> M:\OpenSource\llvm-trunk\build\Debug\bin>
>
>
>
>
> What is the reason for what? What should I do?
>
> thanks!
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150701/bc0c5c0c/attachment.html>


More information about the cfe-dev mailing list