Skip to content

OpenMP TARGET DATA crash with IF(.FALSE.) #145558

@kparzysz

Description

@kparzysz

A modified version of use_device_ptr-1.f90 from the gfortran test suite:

use iso_c_binding, only: c_ptr
implicit none (external, type)

interface
  subroutine bar(x)
    import
    type(c_ptr), value :: x
  end
end interface

type(c_ptr) :: x

!$omp target data map(alloc: x) if(.false.)
!$omp target data use_device_ptr(x) if(.false.)
  call bar(x)
!$omp end target data
!$omp end target data
end

flang -fc1 -emit-llvm -module-dir -fopenmp use_device_ptr-1.f90

where "module-dir" = install_prefix/include/flang (directory that contains iso_c_binding.mod)

 #0 0x00007e68dbde3840 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/work2/kparzysz/c/org/bin/../lib/libLLVMSupport.so.21.0git+0x1e3840)
 #1 0x00007e68dbde0c4f llvm::sys::RunSignalHandlers() (/work2/kparzysz/c/org/bin/../lib/libLLVMSupport.so.21.0git+0x1e0c4f)
 #2 0x00007e68dbde0d9a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007e68db442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007e68db4969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007e68db4969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007e68db4969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007e68db442476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007e68db4287f3 abort ./stdlib/abort.c:81:7
 #9 0x00007e68db42871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007e68db439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00007e68d879e943 llvm::TargetFolder::FoldGEP(llvm::Type*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::GEPNoWrapFlags) const (/work2/kparzysz/c/org/bin/../lib/../lib/libLLVMAnalysis.so.21.0git+0x19e943)
#12 0x00007e68d1fa36cd llvm::IRBuilderBase::CreateGEP(llvm::Type*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&, llvm::GEPNoWrapFlags) (/work2/kparzysz/c/org/bin/../lib/../lib/../lib/libMLIRLLVMToLLVMIRTranslation.so.21.0git+0x266cd)
#13 0x00007e68d1fc41cb convertOperationImpl(mlir::Operation&, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) LLVMToLLVMIRTranslation.cpp:0:0
#14 0x00007e68dafc7636 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x2e636)
#15 0x00007e68dafd2892 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x39892)
#16 0x00007e68d35cedcb inlineConvertOmpRegions(mlir::Region&, llvm::StringRef, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&, llvm::SmallVectorImpl<llvm::Value*>*) OpenMPToLLVMIRTranslation.cpp:0:0
#17 0x00007e68d35d1eb5 llvm::Expected<llvm::IRBuilderBase::InsertPoint> llvm::function_ref<llvm::Expected<llvm::IRBuilderBase::InsertPoint> (llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy)>::callback_fn<convertOmpTargetData(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&)::'lambda6'(llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy)>(long, llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy) OpenMPToLLVMIRTranslation.cpp:0:0
#18 0x00007e68d7fc70c0 llvm::OpenMPIRBuilder::createTargetData(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint, llvm::Value*, llvm::Value*, llvm::OpenMPIRBuilder::TargetDataInfo&, llvm::function_ref<llvm::OpenMPIRBuilder::MapInfosTy& (llvm::IRBuilderBase::InsertPoint)>, llvm::function_ref<llvm::Expected<llvm::Function*> (unsigned int)>, llvm::omp::RuntimeFunction*, llvm::function_ref<llvm::Expected<llvm::IRBuilderBase::InsertPoint> (llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy)>, llvm::function_ref<void (unsigned int, llvm::Value*)>, llvm::Value*) (/work2/kparzysz/c/org/bin/../lib/../lib/libLLVMFrontendOpenMP.so.21.0git+0x930c0)
#19 0x00007e68d35c4279 convertOmpTargetData(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
#20 0x00007e68d35e5559 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
#21 0x00007e68dafc7636 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x2e636)
#22 0x00007e68dafd2892 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x39892)
#23 0x00007e68d35cedcb inlineConvertOmpRegions(mlir::Region&, llvm::StringRef, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&, llvm::SmallVectorImpl<llvm::Value*>*) OpenMPToLLVMIRTranslation.cpp:0:0
#24 0x00007e68d35d1eb5 llvm::Expected<llvm::IRBuilderBase::InsertPoint> llvm::function_ref<llvm::Expected<llvm::IRBuilderBase::InsertPoint> (llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy)>::callback_fn<convertOmpTargetData(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&)::'lambda6'(llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy)>(long, llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy) OpenMPToLLVMIRTranslation.cpp:0:0
#25 0x00007e68d7fc70c0 llvm::OpenMPIRBuilder::createTargetData(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::IRBuilderBase::InsertPoint, llvm::IRBuilderBase::InsertPoint, llvm::Value*, llvm::Value*, llvm::OpenMPIRBuilder::TargetDataInfo&, llvm::function_ref<llvm::OpenMPIRBuilder::MapInfosTy& (llvm::IRBuilderBase::InsertPoint)>, llvm::function_ref<llvm::Expected<llvm::Function*> (unsigned int)>, llvm::omp::RuntimeFunction*, llvm::function_ref<llvm::Expected<llvm::IRBuilderBase::InsertPoint> (llvm::IRBuilderBase::InsertPoint, llvm::OpenMPIRBuilder::BodyGenTy)>, llvm::function_ref<void (unsigned int, llvm::Value*)>, llvm::Value*) (/work2/kparzysz/c/org/bin/../lib/../lib/libLLVMFrontendOpenMP.so.21.0git+0x930c0)
#26 0x00007e68d35c4279 convertOmpTargetData(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
#27 0x00007e68d35e5559 convertHostOrTargetOperation(mlir::Operation*, llvm::IRBuilderBase&, mlir::LLVM::ModuleTranslation&) OpenMPToLLVMIRTranslation.cpp:0:0
#28 0x00007e68dafc7636 mlir::LLVM::ModuleTranslation::convertOperation(mlir::Operation&, llvm::IRBuilderBase&, bool) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x2e636)
#29 0x00007e68dafd2892 mlir::LLVM::ModuleTranslation::convertBlockImpl(mlir::Block&, bool, llvm::IRBuilderBase&, bool) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x39892)
#30 0x00007e68dafd4126 mlir::LLVM::ModuleTranslation::convertOneFunction(mlir::LLVM::LLVMFuncOp) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x3b126)
#31 0x00007e68dafd4bb8 mlir::LLVM::ModuleTranslation::convertFunctions() (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x3bbb8)
#32 0x00007e68dafdebf6 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef, bool) (/work2/kparzysz/c/org/bin/../lib/../lib/libMLIRTargetLLVMIRExport.so.21.0git+0x45bf6)
#33 0x00007e68de2e7785 Fortran::frontend::CodeGenAction::generateLLVMIR() (/work2/kparzysz/c/org/bin/../lib/libflangFrontend.so.21.0git+0x156785)
#34 0x00007e68de2ec980 Fortran::frontend::CodeGenAction::executeAction() (/work2/kparzysz/c/org/bin/../lib/libflangFrontend.so.21.0git+0x15b980)
#35 0x00007e68de2d1c11 Fortran::frontend::FrontendAction::execute() (/work2/kparzysz/c/org/bin/../lib/libflangFrontend.so.21.0git+0x140c11)
#36 0x00007e68de1b424b Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/work2/kparzysz/c/org/bin/../lib/libflangFrontend.so.21.0git+0x2324b)
#37 0x00007e68e047cb8e Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/work2/kparzysz/c/org/bin/../lib/libflangFrontendTool.so.21.0git+0x4b8e)
#38 0x00006497a86c590d fc1_main(llvm::ArrayRef<char const*>, char const*) (/work/kparzysz/c/org/bin/flang+0x890d)
#39 0x00006497a86c3ce3 main (/work/kparzysz/c/org/bin/flang+0x6ce3)
#40 0x00007e68db429d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#41 0x00007e68db429e40 call_init ./csu/../csu/libc-start.c:128:20
#42 0x00007e68db429e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#43 0x00006497a86c4205 _start (/work/kparzysz/c/org/bin/flang+0x7205)
Aborted (core dumped)

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions