[llvm-bugs] [Bug 34803] New: array to pointer decay inside seh except block leads crash

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 2 08:46:17 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34803

            Bug ID: 34803
           Summary: array to pointer decay inside seh except block leads
                    crash
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: comicfans44 at gmail.com
                CC: llvm-bugs at lists.llvm.org

following code leads crash


 int exp(const char* FunctionName)
 {
  return 0;
 }


 bool call()
 {
  __try
  {

   return true;
  }
  __except( exp( __FUNCTION__) )
  {

   return false;
  }
 }


 int main(int , char**){

 return 0;
 }







clang crash stack shows:
        cl.exe!llvm::isa_impl_cl<clang::BlockDecl,clang::Decl const
*>::doit(const clang::Decl * Val) line 106  
        cl.exe!llvm::isa_impl_wrap<clang::BlockDecl,clang::Decl const
*,clang::Decl const *>::doit(const clang::Decl * const & Val) line 133    
        cl.exe!llvm::isa_impl_wrap<clang::BlockDecl,clang::Decl const *
const,clang::Decl const *>::doit(const clang::Decl * const & Val) line 123      
        cl.exe!llvm::isa<clang::BlockDecl,clang::Decl const *>(const
clang::Decl * const & Val) line 143        
        cl.exe!llvm::dyn_cast<clang::BlockDecl,clang::Decl const >(const
clang::Decl * Val) line 334    
        cl.exe!clang::CodeGen::CodeGenFunction::EmitPredefinedLValue(const
clang::PredefinedExpr * E) line 2531 
        cl.exe!clang::CodeGen::CodeGenFunction::EmitLValue(const clang::Expr *
E) line 1137     
        cl.exe!clang::CodeGen::CodeGenFunction::EmitArrayToPointerDecay(const
clang::Expr * E, clang::CodeGen::LValueBaseInfo * BaseInfo) line 3064     
        cl.exe!`anonymous
namespace'::ScalarExprEmitter::VisitCastExpr(clang::CastExpr * CE) line 1685  
        cl.exe!clang::StmtVisitorBase<clang::make_ptr,`anonymous
namespace'::ScalarExprEmitter,llvm::Value
*>::VisitImplicitCastExpr(clang::ImplicitCastExpr * S) line 423      
        cl.exe!clang::StmtVisitorBase<clang::make_ptr,`anonymous
namespace'::ScalarExprEmitter,llvm::Value *>::Visit(clang::Stmt * S) line 423  
        cl.exe!`anonymous namespace'::ScalarExprEmitter::Visit(clang::Expr * E)
line 358        
        cl.exe!clang::CodeGen::CodeGenFunction::EmitScalarExpr(const
clang::Expr * E, bool IgnoreResultAssign) line 3821        
        cl.exe!clang::CodeGen::CodeGenFunction::EmitAnyExpr(const clang::Expr *
E, clang::CodeGen::AggValueSlot aggSlot, bool ignoreResult) line 175    
        cl.exe!clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(const
clang::Expr * E) line 194       
       
cl.exe!clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList
& args, const clang::Expr * E, clang::QualType type) line 3535  
       
cl.exe!clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList
& Args, llvm::ArrayRef<clang::QualType> ArgTypes,
llvm::iterator_range<clang::Stmt::ConstExprIterator> ArgRange,
clang::CodeGen::CodeGenFunction::AbstractCallee AC, unsigned int ParamsToSkip,
clang::CodeGen::CodeGenFunction::EvaluationOrder Order) line 3412      
       
cl.exe!clang::CodeGen::CodeGenFunction::EmitCallArgs<clang::FunctionProtoType>(clang::CodeGen::CallArgList
& Args, const clang::FunctionProtoType * CallArgTypeInfo,
llvm::iterator_range<clang::Stmt::ConstExprIterator> ArgRange,
clang::CodeGen::CodeGenFunction::AbstractCallee AC, unsigned int ParamsToSkip,
clang::CodeGen::CodeGenFunction::EvaluationOrder Order) line 3831    
        cl.exe!clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType
CalleeType, const clang::CodeGen::CGCallee & OrigCallee, const clang::CallExpr
* E, clang::CodeGen::ReturnValueSlot ReturnValue, llvm::Value * Chain) line
4522        
        cl.exe!clang::CodeGen::CodeGenFunction::EmitCallExpr(const
clang::CallExpr * E, clang::CodeGen::ReturnValueSlot ReturnValue) line 4141  
        cl.exe!`anonymous namespace'::ScalarExprEmitter::VisitCallExpr(const
clang::CallExpr * E) line 517      
        cl.exe!clang::StmtVisitorBase<clang::make_ptr,`anonymous
namespace'::ScalarExprEmitter,llvm::Value *>::Visit(clang::Stmt * S) line 329  
        cl.exe!`anonymous namespace'::ScalarExprEmitter::Visit(clang::Expr * E)
line 358        
        cl.exe!clang::CodeGen::CodeGenFunction::EmitScalarExpr(const
clang::Expr * E, bool IgnoreResultAssign) line 3821        
       
cl.exe!clang::CodeGen::CodeGenFunction::GenerateSEHFilterFunction(clang::CodeGen::CodeGenFunction
& ParentCGF, const clang::SEHExceptStmt & Except) line 1697   
        cl.exe!clang::CodeGen::CodeGenFunction::EnterSEHTryStmt(const
clang::SEHTryStmt & S) line 1815  
        cl.exe!clang::CodeGen::CodeGenFunction::EmitSEHTryStmt(const
clang::SEHTryStmt & S) line 1404   
        cl.exe!clang::CodeGen::CodeGenFunction::EmitStmt(const clang::Stmt * S,
llvm::ArrayRef<clang::Attr const *> Attrs) line 185     
       
cl.exe!clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(const
clang::CompoundStmt & S, bool GetLast, clang::CodeGen::AggValueSlot AggSlot)
line 381        
       
cl.exe!clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList
& Args, const clang::Stmt * Body) line 1122    
        cl.exe!clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl
GD, llvm::Function * Fn, const clang::CodeGen::CGFunctionInfo & FnInfo) line
1287        
       
cl.exe!clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl
GD, llvm::GlobalValue * GV) line 3248      
       
cl.exe!clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl
GD, llvm::GlobalValue * GV) line 2024      
        cl.exe!clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl GD)
line 1801        
        cl.exe!clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl * D)
line 3990       
        cl.exe!`anonymous
namespace'::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef DG) line
160    
        cl.exe!clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef
D) line 168       
        cl.exe!clang::ParseAST(clang::Sema & S, bool PrintStats, bool
SkipFunctionBodies) line 151      
        cl.exe!clang::ASTFrontendAction::ExecuteAction() line 998       
        cl.exe!clang::CodeGenAction::ExecuteAction() line 1024  
        cl.exe!clang::FrontendAction::Execute() line 897        
        cl.exe!clang::CompilerInstance::ExecuteAction(clang::FrontendAction &
Act) line 991     
        cl.exe!clang::ExecuteCompilerInvocation(clang::CompilerInstance *
Clang) line 252       
        cl.exe!cc1_main(llvm::ArrayRef<char const *> Argv, const char * Argv0,
void * MainAddr) line 221        
        cl.exe!ExecuteCC1Tool(llvm::ArrayRef<char const *> argv,
llvm::StringRef Tool) line 309 
        cl.exe!main(int argc_, const char * * argv_) line 388   





finally in CGExpr.cpp:2531 
LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) {
...
if (auto *BD= dyn_cast<BlockDecl>(CurCodeDecl))
but CurCodeDecl is NULL

this CodeGenFunction is created at CGException.cpp:1782

void CodeGenFunction::EnterSEHTryStmt(const SEHTryStmt &S) {
  CodeGenFunction HelperCGF(CGM, /*suppressNewContext=*/true);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171002/6e5db63c/attachment.html>


More information about the llvm-bugs mailing list