FYI :) Here is the back trace when emitting the error:
* frame #0: 0x000000010271ea30 clang`clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(this=0x00007fff5fbf8c58, FD=0x000000010f214260, BuiltinID=1483, E=0x000000010f214500, ReturnValue=ReturnValueSlot at 0x00007fff5fbf5fe0) + 49360 at CGBuiltin.cpp:2033 frame #1: 0x000000010283f76f clang`clang::CodeGen::CodeGenFunction::EmitCallExpr(this=0x00007fff5fbf8c58, E=0x000000010f214500, ReturnValue=ReturnValueSlot at 0x00007fff5fbf6990) + 447 at CGExpr.cpp:3506 frame #2: 0x000000010288ae23 clang`(anonymous namespace)::ScalarExprEmitter::VisitCallExpr(this=0x00007fff5fbf7380, E=0x000000010f214500) + 163 at CGExprScalar.cpp:326 frame #3: 0x0000000102885d52 clang`clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(this=0x00007fff5fbf7380, S=0x000000010f214500) + 2866 at StmtNodes.inc:311 frame #4: 0x000000010287f479 clang`(anonymous namespace)::ScalarExprEmitter::Visit(this=0x00007fff5fbf7380, E=0x000000010f214500) + 73 at CGExprScalar.cpp:205 frame #5: 0x0000000102892a4f clang`(anonymous namespace)::ScalarExprEmitter::VisitCastExpr(this=0x00007fff5fbf7380, CE=0x000000010f214548) + 655 at CGExprScalar.cpp:1391 frame #6: 0x00000001028927ae clang`(anonymous namespace)::ScalarExprEmitter::VisitExplicitCastExpr(this=0x00007fff5fbf7380, E=0x000000010f214548) + 62 at CGExprScalar.cpp:318 frame #7: 0x000000010288af48 clang`clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::VisitCStyleCastExpr(this=0x00007fff5fbf7380, S=0x000000010f214548) + 40 at StmtNodes.inc:351 frame #8: 0x0000000102885dde clang`clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(this=0x00007fff5fbf7380, S=0x000000010f214548) + 3006 at StmtNodes.inc:351 frame #9: 0x000000010287f479 clang`(anonymous namespace)::ScalarExprEmitter::Visit(this=0x00007fff5fbf7380, E=0x000000010f214548) + 73 at CGExprScalar.cpp:205 frame #10: 0x000000010287f3e0 clang`clang::CodeGen::CodeGenFunction::EmitScalarExpr(this=0x00007fff5fbf8c58, E=0x000000010f214548, IgnoreResultAssign=false) + 192 at CGExprScalar.cpp:3463 frame #11: 0x0000000102828146 clang`clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(this=0x00007fff5fbf8c58, E=0x000000010f214548, Location=Address at 0x00007fff5fbf7630, Quals=(Mask = 0), IsInit=false) + 502 at CGExpr.cpp:188 frame #12: 0x0000000102969778 clang`clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(this=0x00007fff5fbf8c58, S=0x000000010f214570, GetLast=true, AggSlot=AggValueSlot at 0x00007fff5fbf7700) + 552 at CGStmt.cpp:327 frame #13: 0x00000001029688e9 clang`clang::CodeGen::CodeGenFunction::EmitCompoundStmt(this=0x00007fff5fbf8c58, S=0x000000010f214570, GetLast=true, AggSlot=AggValueSlot at 0x00007fff5fbf77d0) + 297 at CGStmt.cpp:293 frame #14: 0x000000010288e9e5 clang`(anonymous namespace)::ScalarExprEmitter::VisitStmtExpr(this=0x00007fff5fbf8410, E=0x000000010f214598) + 197 at CGExprScalar.cpp:1598 frame #15: 0x000000010288646e clang`clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(this=0x00007fff5fbf8410, S=0x000000010f214598) + 4686 at StmtNodes.inc:735 frame #16: 0x000000010287f479 clang`(anonymous namespace)::ScalarExprEmitter::Visit(this=0x00007fff5fbf8410, E=0x000000010f214598) + 73 at CGExprScalar.cpp:205 frame #17: 0x0000000102889df0 clang`(anonymous namespace)::ScalarExprEmitter::VisitUnaryExtension(this=0x00007fff5fbf8410, E=0x000000010f2145b8) + 48 at CGExprScalar.cpp:382 frame #18: 0x00000001028857bb clang`clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(this=0x00007fff5fbf8410, S=0x000000010f2145b8) + 1435 at StmtVisitor.h:96 frame #19: 0x000000010287f479 clang`(anonymous namespace)::ScalarExprEmitter::Visit(this=0x00007fff5fbf8410, E=0x000000010f2145b8) + 73 at CGExprScalar.cpp:205 frame #20: 0x0000000102892a4f clang`(anonymous namespace)::ScalarExprEmitter::VisitCastExpr(this=0x00007fff5fbf8410, CE=0x000000010f2145d8) + 655 at CGExprScalar.cpp:1391 frame #21: 0x000000010288b098 clang`clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::VisitImplicitCastExpr(this=0x00007fff5fbf8410, S=0x000000010f2145d8) + 40 at StmtNodes.inc:405 frame #22: 0x0000000102885ea2 clang`clang::StmtVisitorBase<clang::make_ptr, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(this=0x00007fff5fbf8410, S=0x000000010f2145d8) + 3202 at StmtNodes.inc:405 frame #23: 0x000000010287f479 clang`(anonymous namespace)::ScalarExprEmitter::Visit(this=0x00007fff5fbf8410, E=0x000000010f2145d8) + 73 at CGExprScalar.cpp:205 frame #24: 0x000000010287f3e0 clang`clang::CodeGen::CodeGenFunction::EmitScalarExpr(this=0x00007fff5fbf8c58, E=0x000000010f2145d8, IgnoreResultAssign=false) + 192 at CGExprScalar.cpp:3463 frame #25: 0x000000010295e9df clang`clang::CodeGen::CodeGenFunction::EmitReturnStmt(this=0x00007fff5fbf8c58, S=0x000000010f2145f0) + 927 at CGStmt.cpp:979 frame #26: 0x000000010295c611 clang`clang::CodeGen::CodeGenFunction::EmitStmt(this=0x00007fff5fbf8c58, S=0x000000010f2145f0) + 993 at CGStmt.cpp:139 frame #27: 0x00000001029695d5 clang`clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(this=0x00007fff5fbf8c58, S=0x000000010f214608, GetLast=false, AggSlot=AggValueSlot at 0x00007fff5fbf8850) + 133 at CGStmt.cpp:303 frame #28: 0x00000001029b8d14 clang`clang::CodeGen::CodeGenFunction::EmitFunctionBody(this=0x00007fff5fbf8c58, Args=0x00007fff5fbf8b20, Body=0x000000010f214608) + 116 at CodeGenFunction.cpp:850 frame #29: 0x00000001029b95ac clang`clang::CodeGen::CodeGenFunction::GenerateCode(this=0x00007fff5fbf8c58, GD=GlobalDecl at 0x00007fff5fbf8aa8, Fn=0x0000000117495b98, FnInfo=0x0000000117495ab0) + 1900 at CodeGenFunction.cpp:967 frame #30: 0x00000001029d5791 clang`clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(this=0x000000010d83d600, GD=GlobalDecl at 0x00007fff5fbf8c50, GV=0x0000000117495b98) + 577 at CodeGenModule.cpp:2648 frame #31: 0x00000001029cf77d clang`clang::CodeGen::CodeGenModule::EmitGlobalDefinition(this=0x000000010d83d600, GD=GlobalDecl at 0x00007fff5fbf96b8, GV=0x0000000117495b98) + 733 at CodeGenModule.cpp:1651 frame #32: 0x00000001029c7fae clang`clang::CodeGen::CodeGenModule::EmitDeferred(this=0x000000010d83d600) + 1166 at CodeGenModule.cpp:1198 frame #33: 0x00000001029c800a clang`clang::CodeGen::CodeGenModule::EmitDeferred(this=0x000000010d83d600) + 1258 at CodeGenModule.cpp:1204 frame #34: 0x00000001029c6ec6 clang`clang::CodeGen::CodeGenModule::Release(this=0x000000010d83d600) + 54 at CodeGenModule.cpp:360 frame #35: 0x0000000102b567d2 clang`(anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(this=0x000000010c6138b0, Ctx=0x000000010d838400) + 562 at ModuleBuilder.cpp:210 frame #36: 0x00000001029ac8ea clang`clang::BackendConsumer::HandleTranslationUnit(this=0x000000010c613750, C=0x000000010d838400) + 202 at CodeGenAction.cpp:141 frame #37: 0x0000000103edb49f clang`clang::ParseAST(S=0x000000010d862600, PrintStats=false, SkipFunctionBodies=false) + 1295 at ParseAST.cpp:168 frame #38: 0x0000000102f24b1f clang`clang::ASTFrontendAction::ExecuteAction(this=0x000000010c60aeb0) + 511 at FrontendAction.cpp:545 frame #39: 0x00000001029ab027 clang`clang::CodeGenAction::ExecuteAction(this=0x000000010c60aeb0) + 6343 at CodeGenAction.cpp:807 frame #40: 0x0000000102f24080 clang`clang::FrontendAction::Execute(this=0x000000010c60aeb0) + 112 at FrontendAction.cpp:446 frame #41: 0x0000000102e75468 clang`clang::CompilerInstance::ExecuteAction(this=0x000000010c60a1b0, Act=0x000000010c60aeb0) + 1592 at CompilerInstance.cpp:846 frame #42: 0x0000000102fb3bba clang`clang::ExecuteCompilerInvocation(Clang=0x000000010c60a1b0) + 4410 at ExecuteCompilerInvocation.cpp:222 frame #43: 0x000000010001596e clang`cc1_main(Argv=ArrayRef<const char *> at 0x00007fff5fbfbde0, Argv0=0x00007fff5fbff770, MainAddr=0x0000000100001f70) + 4926 at cc1_main.cpp:116 frame #44: 0x0000000100005324 clang`ExecuteCC1Tool(argv=ArrayRef<const char *> at 0x00007fff5fbfcd00, Tool=(Data = "", Length = 0)) + 500 at driver.cpp:303 frame #45: 0x0000000100002cdd clang`main(argc_=90, argv_=0x00007fff5fbff380) + 3245 at driver.cpp:370 On Thu, Jan 28, 2016 at 11:43 AM, Eric Christopher <echri...@gmail.com> wrote: > I'm also just curious how we got all the way to here without having the > error emitted and compilation stopped? > > -eric > > > On Thu, Jan 28, 2016 at 9:53 AM Justin Bogner <m...@justinbogner.com> > wrote: > >> Manman Ren via cfe-commits <cfe-commits@lists.llvm.org> writes: >> > manmanren created this revision. >> > manmanren added reviewers: echristo, rafael, ahatanak. >> > manmanren added a subscriber: cfe-commits. >> > >> > It can happen that frontend emits error message when releasing the >> > builder. When that happens, we emit the error message and continue to >> > invoke backend. >> > Backend will then crash. >> > >> > The fix is quite simple, we check for errors after releasing the >> builder. >> > >> > http://reviews.llvm.org/D16564 >> > >> > Files: >> > lib/CodeGen/ModuleBuilder.cpp >> > test/CodeGen/target-builtin-error-3.c >> > >> > >> > Index: test/CodeGen/target-builtin-error-3.c >> > =================================================================== >> > --- test/CodeGen/target-builtin-error-3.c >> > +++ test/CodeGen/target-builtin-error-3.c >> > @@ -0,0 +1,28 @@ >> > +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -S -verify -o - >> -target-feature +avx >> > + >> > +// RUN: not %clang_cc1 %s -triple=x86_64-apple-darwin -emit-obj >> -target-feature +avx 2> %t.err >> > +// RUN: FileCheck < %t.err %s >> > +// CHECK: 1 error generated >> > + >> > +typedef unsigned short uint16_t; >> > +typedef long long __m128i __attribute__((__vector_size__(16))); >> > +typedef float __v8sf __attribute__ ((__vector_size__ (32))); >> > +typedef float __m256 __attribute__ ((__vector_size__ (32))); >> > +typedef uint16_t half; >> > +typedef __attribute__ ((ext_vector_type( 8),__aligned__( 16))) half >> half8; >> > +typedef __attribute__ ((ext_vector_type(16),__aligned__( 32))) half >> half16; >> > +typedef __attribute__ ((ext_vector_type(16),__aligned__( 2))) half >> half16U; >> > +typedef __attribute__ ((ext_vector_type( 8),__aligned__( 32))) float >> float8; >> > +typedef __attribute__ ((ext_vector_type(16),__aligned__( 64))) float >> float16; >> > +static inline half8 __attribute__((__overloadable__)) convert_half( >> float8 a ) { >> > + return __extension__ ({ __m256 __a = (a); >> (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (0x00)); }); // >> expected-error {{'__builtin_ia32_vcvtps2ph256' needs target feature f16c}} >> > +} >> > +static inline half16 __attribute__((__overloadable__)) convert_half( >> float16 a ) { >> > + half16 r; >> > + r.lo = convert_half( a.lo); >> > + return r; >> > +} >> > +void avx_test( uint16_t *destData, float16 argbF) >> > +{ >> > + ((half16U*)destData)[0] = convert_half(argbF); >> > +} >> > Index: lib/CodeGen/ModuleBuilder.cpp >> > =================================================================== >> > --- lib/CodeGen/ModuleBuilder.cpp >> > +++ lib/CodeGen/ModuleBuilder.cpp >> > @@ -208,6 +208,14 @@ >> > >> > if (Builder) >> > Builder->Release(); >> > + >> > + // Builder->Release can cause diagnostics to be generated. >> >> This comment's a bit confusing. Isn't it more like "If errors occurred >> while building the module, we need to stop here before invoking the >> backend", or something like that? >> >> > + if (Diags.hasErrorOccurred()) { >> > + if (Builder) >> > + Builder->clear(); >> > + M.reset(); >> > + return; >> > + } >> > } >> > >> > void CompleteTentativeDefinition(VarDecl *D) override { >> > >> >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits