tianshilei1992 added a comment.

In D89802#2359537 <https://reviews.llvm.org/D89802#2359537>, @jhuber6 wrote:

> In D89802#2359504 <https://reviews.llvm.org/D89802#2359504>, @tianshilei1992 
> wrote:
>
>> This patch caused segment fault in D90099 <https://reviews.llvm.org/D90099> 
>> where the map variable info pointer is `nullptr` but it is deferenced.
>
> Was it this one, or was it D90172 <https://reviews.llvm.org/D90172>. This 
> patch only changes the code generation in Clang so I don't think it 
> references the generated mapping pointers. It's possible I forget to check 
> the status of the pointer somewhere in the RTL.

The dereference is in the Clang. I happened to have a full log:

  $ clang -cc1 -DCK1 -verify -fopenmp 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm 
$HOME/Documents/vscode/llvm-project/clang/test/OpenMP/target_exit_data_codegen.cpp
 -o target_exit_data_codegen.ll
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash 
backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.      Program arguments: clang -cc1 -DCK1 -verify -fopenmp 
-fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple 
powerpc64le-unknown-unknown -emit-llvm 
/home/shiltian/Documents/vscode/llvm-project/clang/test/OpenMP/target_exit_data_codegen.cpp
 -o target_exit_data_codegen.ll
  1.      <eof> parser at end of file
  2.      Per-file LLVM IR generation
  3.      
/home/shiltian/Documents/vscode/llvm-project/clang/test/OpenMP/target_exit_data_codegen.cpp:48:6:
 Generating code for declaration 'foo'
   #0 0x000055b62a4406ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x1f3d6ec)
   #1 0x000055b62a43e3c4 llvm::sys::RunSignalHandlers() 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x1f3b3c4)
   #2 0x000055b62a43e533 SignalHandler(int) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x1f3b533)
   #3 0x00007f0bb92d98a0 __restore_rt 
(/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
   #4 0x000055b629ce8dbc llvm::CallInst::init(llvm::FunctionType*, 
llvm::Value*, llvm::ArrayRef<llvm::Value*>, 
llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x17e5dbc)
   #5 0x000055b629cc48c2 llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, 
llvm::Value*, llvm::ArrayRef<llvm::Value*>, 
llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, 
llvm::MDNode*) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x17c18c2)
   #6 0x000055b62a95d7e1 
clang::CodeGen::CodeGenFunction::EmitRuntimeCall(llvm::FunctionCallee, 
llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x245a7e1)
   #7 0x000055b62aa7756b void 
clang::CodeGen::RegionCodeGenTy::CallbackFn<clang::CodeGen::CGOpenMPRuntime::emitTargetDataStandAloneCall(clang::CodeGen::CodeGenFunction&,
 clang::OMPExecutableDirective const&, clang::Expr const*, clang::Expr 
const*)::'lambda'(clang::CodeGen::CodeGenFunction&, 
clang::CodeGen::PrePostActionTy&)>(long, clang::CodeGen::CodeGenFunction&, 
clang::CodeGen::PrePostActionTy&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x257456b)
   #8 0x000055b62aa735b0 
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&) 
const (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x25705b0)
   #9 0x000055b62a74bd59 
clang::CodeGen::CodeGenFunction::EmitOMPTargetTaskBasedDirective(clang::OMPExecutableDirective
 const&, clang::CodeGen::RegionCodeGenTy const&, 
clang::CodeGen::CodeGenFunction::OMPTargetDataInfo&)::'lambda3'(clang::CodeGen::CodeGenFunction&,
 
clang::CodeGen::PrePostActionTy&)::operator()(clang::CodeGen::CodeGenFunction&, 
clang::CodeGen::PrePostActionTy&) const 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2248d59)
  #10 0x000055b62aa7361f 
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&) 
const (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x257061f)
  #11 0x000055b62aa738af (anonymous 
namespace)::CGOpenMPRegionInfo::EmitBody(clang::CodeGen::CodeGenFunction&, 
clang::Stmt const*) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x25708af)
  #12 0x000055b62a72f42e 
clang::CodeGen::CodeGenFunction::GenerateCapturedStmtFunction(clang::CapturedStmt
 const&) (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x222c42e)
  #13 0x000055b62aab4708 
clang::CodeGen::CGOpenMPRuntime::emitTaskOutlinedFunction(clang::OMPExecutableDirective
 const&, clang::VarDecl const*, clang::VarDecl const*, clang::VarDecl const*, 
llvm::omp::Directive, clang::CodeGen::RegionCodeGenTy const&, bool, unsigned 
int&) (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x25b1708)
  #14 0x000055b62a74d469 
clang::CodeGen::CodeGenFunction::EmitOMPTargetTaskBasedDirective(clang::OMPExecutableDirective
 const&, clang::CodeGen::RegionCodeGenTy const&, 
clang::CodeGen::CodeGenFunction::OMPTargetDataInfo&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x224a469)
  #15 0x000055b62aac0c70 
clang::CodeGen::CGOpenMPRuntime::emitTargetDataStandAloneCall(clang::CodeGen::CodeGenFunction&,
 clang::OMPExecutableDirective const&, clang::Expr const*, clang::Expr 
const*)::'lambda0'(clang::CodeGen::CodeGenFunction&, 
clang::CodeGen::PrePostActionTy&)::operator()(clang::CodeGen::CodeGenFunction&, 
clang::CodeGen::PrePostActionTy&) const (.isra.2413) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x25bdc70)
  #16 0x000055b62aa735b0 
clang::CodeGen::RegionCodeGenTy::operator()(clang::CodeGen::CodeGenFunction&) 
const (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x25705b0)
  #17 0x000055b62aa745c8 
clang::CodeGen::CGOpenMPRuntime::emitIfClause(clang::CodeGen::CodeGenFunction&, 
clang::Expr const*, clang::CodeGen::RegionCodeGenTy const&, 
clang::CodeGen::RegionCodeGenTy const&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x25715c8)
  #18 0x000055b62aa74b1d 
clang::CodeGen::CGOpenMPRuntime::emitTargetDataStandAloneCall(clang::CodeGen::CodeGenFunction&,
 clang::OMPExecutableDirective const&, clang::Expr const*, clang::Expr const*) 
(.part.1404) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2571b1d)
  #19 0x000055b62a74c7db 
clang::CodeGen::CodeGenFunction::EmitOMPTargetExitDataDirective(clang::OMPTargetExitDataDirective
 const&) (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x22497db)
  #20 0x000055b62a7301cd clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt 
const*, llvm::ArrayRef<clang::Attr const*>) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x222d1cd)
  #21 0x000055b62a73048c 
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
 const&, bool, clang::CodeGen::AggValueSlot) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x222d48c)
  #22 0x000055b62a77bccb 
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2278ccb)
  #23 0x000055b62a78bffd 
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, 
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2288ffd)
  #24 0x000055b62a7d5723 
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, 
llvm::GlobalValue*) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x22d2723)
  #25 0x000055b62a7d30c5 
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, 
llvm::GlobalValue*) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x22d00c5)
  #26 0x000055b62a7da877 clang::CodeGen::CodeGenModule::EmitDeferred() 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x22d7877)
  #27 0x000055b62a7dad6c clang::CodeGen::CodeGenModule::Release() 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x22d7d6c)
  #28 0x000055b62b2c3737 (anonymous 
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2dc0737)
  #29 0x000055b62b2c1f35 
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2dbef35)
  #30 0x000055b62bf051e9 clang::ParseAST(clang::Sema&, bool, bool) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x3a021e9)
  #31 0x000055b62b2c0e90 clang::CodeGenAction::ExecuteAction() 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2dbde90)
  #32 0x000055b62ac95729 clang::FrontendAction::Execute() 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x2792729)
  #33 0x000055b62ac4f75a 
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x274c75a)
  #34 0x000055b62ad5fc26 
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0x285cc26)
  #35 0x000055b629189d7c cc1_main(llvm::ArrayRef<char const*>, char const*, 
void*) (/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0xc86d7c)
  #36 0x000055b629184879 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0xc81879)
  #37 0x000055b6290ff094 main 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0xbfc094)
  #38 0x00007f0bb7f6db97 __libc_start_main 
/build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:344:0
  #39 0x000055b6291843da _start 
(/home/shiltian/Documents/deploy/llvm/release/bin/clang-12+0xc813da)
  [1]    25935 segmentation fault (core dumped)  clang -cc1 -DCK1 -verify 
-fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89802/new/

https://reviews.llvm.org/D89802

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to