[cfe-dev] Problems with Clang since upgrading compiler to Visual Studio 2015

Kim via cfe-dev cfe-dev at lists.llvm.org
Fri Mar 3 04:47:15 PST 2017


That may be so but I'm not sure where the bug could be occurring because my
code is very simple; I literally just invoke the compiler. I've pastebinned
my code here: http://pastebin.com/wpS6VX5N

A weird thing is that when this invocation code is built into a debug dll
with optimization disabled (as I need in my project), I hit the previously
mentioned assert when running, but it works perfectly when it's compiled
straight into a debug executable. If I set the optimization level to O2
instead of disabled on the dll then it also works fine.

On Tue, Feb 28, 2017 at 5:58 PM, Yaron Keren <yaron.keren at gmail.com> wrote:

> I'm using VS2015 Update 3 too. So it may be a real bug in your code...
>
>
> ‫בתאריך יום ג׳, 28 בפבר׳ 2017 ב-11:31 מאת ‪Kim‬‏ <‪sugoimoe at gmail.com‬‏>:‬
>
>> Yes, this is 2015 update 3 (14.0.25431.01) and under debug with
>> optimizations disabled.
>>
>> On Tue, Feb 28, 2017 at 5:07 PM, Yaron Keren <yaron.keren at gmail.com>
>> wrote:
>>
>> Are you using VS 2015 Update 3?
>> Does this happen with optimization disabled?
>>
>>
>> ‫בתאריך יום ג׳, 28 בפבר׳ 2017 ב-10:39 מאת ‪Kim via cfe-dev‬‏ <‪
>> cfe-dev at lists.llvm.org‬‏>:‬
>>
>> Hi guys,
>>
>> I'm having an issue with clang/llvm since I upgraded my compiler from
>> VS2013 to VS2015. I'm invoking clang programmatically to compile C++ source
>> files and up till now it has worked fine but since the upgrade and
>> recompiling all the clang/llvm libraries I'm getting some errors deep
>> inside the clang/llvm source without having changed any code on my end. The
>> problem I'm facing right now is an assertion being triggered in an llvm
>> class:
>>
>> Assertion failed: HasHungOffUses && "alloc must have hung off uses", file
>> F:\Cla
>> nggit\llvm\lib\IR\User.cpp, line 44
>>
>> Here is the complete call stack up till the assertion:
>>
>> ucrtbased.dll!___threadid () Unknown
>>   ucrtbased.dll!___acrt_report_runtime_error () Unknown
>>   ucrtbased.dll!_abort () Unknown
>>   ucrtbased.dll!__crt_char_traits<char>::tcsncat_s<char * &,unsigned int
>> const &,char const * const &,unsigned int const >(char * &,unsigned int
>> const &,char const * const &,unsigned int const &&) Unknown
>>   ucrtbased.dll!__get_wide_winmain_command_line () Unknown
>>   ucrtbased.dll!__get_wide_winmain_command_line () Unknown
>>   ucrtbased.dll!__wassert () Unknown
>>   Plugin_Clang_d.dll!llvm::User::allocHungoffUses(unsigned int N, bool
>> IsPhi) Line 44 C++
>> > Plugin_Clang_d.dll!llvm::Function::allocHungoffUselist() Line 1234 C++
>>   Plugin_Clang_d.dll!llvm::Function::setHungoffOperand<0>(llvm::Constant
>> * C) Line 1247 C++
>>   Plugin_Clang_d.dll!llvm::Function::setPersonalityFn(llvm::Constant *
>> Fn) Line 1205 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::getInvokeDestImpl()
>> Line 722 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::getInvokeDest()
>> Line 1412 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitCall(const
>> clang::CodeGen::CGFunctionInfo & CallInfo, const clang::CodeGen::CGCallee &
>> Callee, clang::CodeGen::ReturnValueSlot ReturnValue, const
>> clang::CodeGen::CallArgList & CallArgs, llvm::Instruction * * callOrInvoke)
>> Line 4090 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::
>> EmitCXXMemberOrOperatorCall(const clang::CXXMethodDecl * MD, const
>> clang::CodeGen::CGCallee & Callee, clang::CodeGen::ReturnValueSlot
>> ReturnValue, llvm::Value * This, llvm::Value * ImplicitParam,
>> clang::QualType ImplicitParamTy, const clang::CallExpr * CE,
>> clang::CodeGen::CallArgList * RtlArgs) Line 91 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::
>> EmitCXXMemberOrOperatorMemberCallExpr(const clang::CallExpr * CE, const
>> clang::CXXMethodDecl * MD, clang::CodeGen::ReturnValueSlot ReturnValue,
>> bool HasQualifier, clang::NestedNameSpecifier * Qualifier, bool IsArrow,
>> const clang::Expr * Base) Line 385 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(const
>> clang::CXXMemberCallExpr * CE, clang::CodeGen::ReturnValueSlot
>> ReturnValue) Line 188 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitCallExpr(const
>> clang::CallExpr * E, clang::CodeGen::ReturnValueSlot ReturnValue) Line
>> 3870 C++
>>   Plugin_Clang_d.dll!`anonymous namespace'::ScalarExprEmitter::VisitCallExpr(const
>> clang::CallExpr * E) Line 405 C++
>>   Plugin_Clang_d.dll!clang::StmtVisitorBase<clang::make_ptr,`anonymous
>> namespace'::ScalarExprEmitter,llvm::Value *>::VisitCXXMemberCallExpr(clang::CXXMemberCallExpr
>> * S) Line 339 C++
>>   Plugin_Clang_d.dll!clang::StmtVisitorBase<clang::make_ptr,`anonymous
>> namespace'::ScalarExprEmitter,llvm::Value *>::Visit(clang::Stmt * S)
>> Line 339 C++
>>   Plugin_Clang_d.dll!`anonymous namespace'::ScalarExprEmitter::Visit(clang::Expr
>> * E) Line 260 C++
>>   Plugin_Clang_d.dll!`anonymous namespace'::ScalarExprEmitter::VisitCastExpr(clang::CastExpr
>> * CE) Line 1501 C++
>>   Plugin_Clang_d.dll!clang::StmtVisitorBase<clang::make_ptr,`anonymous
>> namespace'::ScalarExprEmitter,llvm::Value *>::VisitImplicitCastExpr(clang::ImplicitCastExpr
>> * S) Line 423 C++
>>   Plugin_Clang_d.dll!clang::StmtVisitorBase<clang::make_ptr,`anonymous
>> namespace'::ScalarExprEmitter,llvm::Value *>::Visit(clang::Stmt * S)
>> Line 423 C++
>>   Plugin_Clang_d.dll!`anonymous namespace'::ScalarExprEmitter::Visit(clang::Expr
>> * E) Line 260 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitScalarExpr(const
>> clang::Expr * E, bool IgnoreResultAssign) Line 3621 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(const
>> clang::Expr * E) Line 123 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(const
>> clang::Expr * Cond, llvm::BasicBlock * TrueBlock, llvm::BasicBlock *
>> FalseBlock, unsigned __int64 TrueCount) Line 1508 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(const
>> clang::Expr * Cond, llvm::BasicBlock * TrueBlock, llvm::BasicBlock *
>> FalseBlock, unsigned __int64 TrueCount) Line 1430 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitIfStmt(const
>> clang::IfStmt & S) Line 656 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::EmitStmt(const
>> clang::Stmt * S) Line 134 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::
>> EmitCompoundStmtWithoutScope(const clang::CompoundStmt & S, bool
>> GetLast, clang::CodeGen::AggValueSlot AggSlot) Line 381 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::
>> EmitFunctionBody(clang::CodeGen::FunctionArgList & Args, const
>> clang::Stmt * Body) Line 990 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl
>> GD, llvm::Function * Fn, const clang::CodeGen::CGFunctionInfo & FnInfo)
>> Line 1161 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenModule::
>> EmitGlobalFunctionDefinition(clang::GlobalDecl GD, llvm::GlobalValue *
>> GV) Line 3052 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenModule::
>> EmitGlobalDefinition(clang::GlobalDecl GD, llvm::GlobalValue * GV) Line
>> 1888 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenModule::EmitDeferred() Line
>> 1360 C++
>>   Plugin_Clang_d.dll!clang::CodeGen::CodeGenModule::Release() Line 377
>> C++
>>   Plugin_Clang_d.dll!`anonymous namespace'::CodeGeneratorImpl:
>> :HandleTranslationUnit(clang::ASTContext & Ctx) Line 261 C++
>>   Plugin_Clang_d.dll!clang::BackendConsumer::
>> HandleTranslationUnit(clang::ASTContext & C) Line 205 C++
>>   Plugin_Clang_d.dll!clang::ParseAST(clang::Sema & S, bool PrintStats,
>> bool SkipFunctionBodies) Line 159 C++
>>   Plugin_Clang_d.dll!clang::ASTFrontendAction::ExecuteAction() Line 567
>> C++
>>   Plugin_Clang_d.dll!clang::CodeGenAction::ExecuteAction() Line 991 C++
>>   Plugin_Clang_d.dll!clang::FrontendAction::Execute() Line 468 C++
>>   Plugin_Clang_d.dll!clang::CompilerInstance::ExecuteAction(clang::FrontendAction
>> & Act) Line 951 C++
>>   Plugin_Clang_d.dll!clang::ExecuteCompilerInvocation(clang::CompilerInstance
>> * Clang) Line 249 C++
>>   Plugin_Clang_d.dll!Compiler::compile(const char * * ArgBegin, const
>> char * * ArgEnd, const char * Argv0, ASTVisitor & visitor) Line 536 C++
>>   Plugin_Clang_d.dll!Compiler::compile(const char * srcFilePath, const
>> char * outputFilePath, Scripta::result & result, const char * * args,
>> unsigned int argsSize) Line 287 C++
>>   scripta-example.exe!ScriptaPlatform::compile(const char * filePath,
>> const char * outputFile) Line 233 C++
>>   scripta-example.exe!ScriptaPlatform::load(const char * filename) Line
>> 395 C++
>>   scripta-example.exe!main() Line 380 C++
>>   [External Code]
>>
>>
>> Here's hoping someone here can give me some guidance on resolving this
>> issue.
>>
>> Thanks a lot for your time.
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170303/7a201beb/attachment.html>


More information about the cfe-dev mailing list