llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.05k stars 11.58k forks source link

Seg fault when compiling known working code #29498

Closed llvmbot closed 7 years ago

llvmbot commented 8 years ago
Bugzilla Link 29128
Resolution WORKSFORME
Resolved on Jan 30, 2017 12:14
Version trunk
OS Linux
Attachments Compile run script, Preprocessed source file (gzip compressed)
Reporter LLVM Bugzilla Contributor
CC @alexey-bataev,@DougGregor,@zmodem

Extended Description

Trunk fails with segfault when compiling known working code (tested with multiple gcc, clang, and icpc versions). Compiler output follows with attachments (it appears to be an openmp issue):

[ 1%] Building CXX object Frankie/CMakeFiles/frankie.dir/RadiationField.cc.o cd /home/tporter/Modelling/frankie/work_dir_clang/Frankie && /opt/llvm/svn/bin/clang++ -DCONFIG_PATH=\"/home/tporter/Install/frankie/clang/config/\" -DDATA_PATH=\"/home/tporter/Install/frankie/clang/data/\" -DENABLE_COMPRESSION -DHAVE_ALM_HEALPIX_TOOLS_H -DHAVE_ALM_POWSPEC_TOOLS_H -DHAVE_LSCONSTANTS_H -DHAVE_WCS -DHEALPIX_STD_COMPLEX -Dfrankie_EXPORTS -fopenmp -fopenmp=libomp -g -pipe -O3 -Wall -mtune=native -std=c++11 -std=c++11 -fPIC -I/home/tporter/Modelling/frankie/work_dir_clang/Frankie -I/home/tporter/Modelling/frankie/Frankie -I/home/tporter/Modelling/frankie/work_dir_clang -I/home/tporter/Modelling/frankie -I/home/tporter/Install/galtoolslib/llvm/include -I/home/tporter/Install/Healpix_3.30/src/cxx/generic_gcc/include -I/usr/local/include -I/usr/include/cfitsio -I/usr/local/lib/CLHEP-2.2.0.8/../../include -o CMakeFiles/frankie.dir/RadiationField.cc.o -c /home/tporter/Modelling/frankie/Frankie/RadiationField.cc In file included from /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:3: In file included from /home/tporter/Modelling/frankie/Frankie/RadiationField.h:18: /home/tporter/Install/galtoolslib/llvm/include/Skymap.h:853:20: warning: unused variable 'tfunc' [-Wunused-variable] void (tfunc)(double,double,double,double,double*) = ∅ ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:697:29: warning: field 'fNumberOfThreads' will be initialized after field 'fGrid' [-Wreorder] fParametersChanged(true), fNumberOfThreads(1), fGrid(0), ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:697:50: warning: field 'fGrid' will be initialized after field 'fDustMultiplier' [-Wreorder] fParametersChanged(true), fNumberOfThreads(1), fGrid(0), ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:699:25: warning: field 'fAVOptimisedUseHost' will be initialized after field 'fUseMJySrUnits' [-Wreorder] fAVOptimisedMICs(-1), fAVOptimisedUseHost(-1), fUseMJySrUnits(false), ... ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:699:73: warning: field 'fOutputFilterMapsOnly' will be initialized after field 'fDumpGrid' [-Wreorder] ...fAVOptimisedUseHost(-1), fUseMJySrUnits(false), fOutputFilterMapsOnly(fa... ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:717:29: warning: field 'fNumberOfThreads' will be initialized after field 'fGrid' [-Wreorder] fParametersChanged(true), fNumberOfThreads(1), fGrid(0), ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:717:50: warning: field 'fGrid' will be initialized after field 'fDustMultiplier' [-Wreorder] fParametersChanged(true), fNumberOfThreads(1), fGrid(0), ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:719:25: warning: field 'fAVOptimisedUseHost' will be initialized after field 'fUseMJySrUnits' [-Wreorder] fAVOptimisedMICs(-1), fAVOptimisedUseHost(-1), fUseMJySrUnits(false), ... ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:719:73: warning: field 'fOutputFilterMapsOnly' will be initialized after field 'fDumpGrid' [-Wreorder] ...fAVOptimisedUseHost(-1), fUseMJySrUnits(false), fOutputFilterMapsOnly(fa... ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:1248:8: warning: unused variable 'log10WlRangeDenom' [-Wunused-variable] auto log10WlRangeDenom = 1./(log10WlMax - log10WlMin); ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:1249:8: warning: unused variable 'log10kSpeedOfLight_SI' [-Wunused-variable] auto log10kSpeedOfLight_SI = log10(utl::kSpeedOfLight_SI); ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:2017:9: warning: unused variable 'coordinate1Delta' [-Wunused-variable] auto& coordinate1Delta = fGrid->GetCoordinate1Delta(); ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:2018:9: warning: unused variable 'coordinate2Delta' [-Wunused-variable] auto& coordinate2Delta = fGrid->GetCoordinate2Delta(); ^ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:2019:9: warning: unused variable 'coordinate3Delta' [-Wunused-variable] auto& coordinate3Delta = fGrid->GetCoordinate3Delta(); ^

​0 0x000000000181d735 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/llvm/svn/bin/clang-4.0+0x181d735)

​1 0x000000000181b96e llvm::sys::RunSignalHandlers() (/opt/llvm/svn/bin/clang-4.0+0x181b96e)

​2 0x000000000181baaa SignalHandler(int) (/opt/llvm/svn/bin/clang-4.0+0x181baaa)

​3 0x00007f9f03aac100 __restore_rt (/lib64/libpthread.so.0+0xf100)

​4 0x0000000002cc35c3 clang::Expr::EvaluateAsInt(llvm::APSInt&, clang::ASTContext const&, clang::Expr::SideEffectsKind) const (/opt/llvm/svn/bin/clang-4.0+0x2cc35c3)

​5 0x000000000197f0de clang::CodeGen::CGDebugInfo::CreateType(clang::ArrayType const, llvm::DIFile) (/opt/llvm/svn/bin/clang-4.0+0x197f0de)

​6 0x00000000019799f6 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/llvm/svn/bin/clang-4.0+0x19799f6)

​7 0x0000000001979cf5 clang::CodeGen::CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag, clang::Type const, clang::QualType, llvm::DIFile) (/opt/llvm/svn/bin/clang-4.0+0x1979cf5)

​8 0x0000000001979dc2 clang::CodeGen::CGDebugInfo::CreateType(clang::LValueReferenceType const, llvm::DIFile) (/opt/llvm/svn/bin/clang-4.0+0x1979dc2)

​9 0x00000000019799f6 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/llvm/svn/bin/clang-4.0+0x19799f6)

​10 0x000000000197a2b6 clang::CodeGen::CGDebugInfo::CreateType(clang::FunctionType const, llvm::DIFile) (/opt/llvm/svn/bin/clang-4.0+0x197a2b6)

​11 0x00000000019799f6 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) (/opt/llvm/svn/bin/clang-4.0+0x19799f6)

​12 0x0000000001980e96 clang::CodeGen::CGDebugInfo::getOrCreateFunctionType(clang::Decl const, clang::QualType, llvm::DIFile) (/opt/llvm/svn/bin/clang-4.0+0x1980e96)

​13 0x0000000001985391 clang::CodeGen::CGDebugInfo::EmitFunctionStart(clang::GlobalDecl, clang::SourceLocation, clang::SourceLocation, clang::QualType, llvm::Function*, clang::CodeGen::CGBuilderTy&) (/opt/llvm/svn/bin/clang-4.0+0x1985391)

​14 0x00000000019cb5bd clang::CodeGen::CodeGenFunction::StartFunction(clang::GlobalDecl, clang::QualType, llvm::Function*, clang::CodeGen::CGFunctionInfo const&, clang::CodeGen::FunctionArgList const&, clang::SourceLocation, clang::SourceLocation) (/opt/llvm/svn/bin/clang-4.0+0x19cb5bd)

​15 0x00000000019c2caa clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(clang::CapturedStmt const&) (/opt/llvm/svn/bin/clang-4.0+0x19c2caa)

​16 0x0000000001b565f7 clang::CodeGen::CGOpenMPRuntime::emitParallelOrTeamsOutlinedFunction(clang::OMPExecutableDirective const&, clang::VarDecl const*, clang::OpenMPDirectiveKind, clang::CodeGen::RegionCodeGenTy const&) (/opt/llvm/svn/bin/clang-4.0+0x1b565f7)

​17 0x00000000019bbcb8 emitCommonOMPParallelDirective(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&, clang::OpenMPDirectiveKind, clang::CodeGen::RegionCodeGenTy const&) [clone .constprop.930] (/opt/llvm/svn/bin/clang-4.0+0x19bbcb8)

​18 0x00000000019bc081 clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(clang::OMPParallelForDirective const&) (/opt/llvm/svn/bin/clang-4.0+0x19bc081)

​19 0x00000000019a38c0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) (/opt/llvm/svn/bin/clang-4.0+0x19a38c0)

​20 0x00000000019a3ad7 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/llvm/svn/bin/clang-4.0+0x19a3ad7)

​21 0x00000000019a3d83 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/llvm/svn/bin/clang-4.0+0x19a3d83)

​22 0x00000000019a6aa8 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) (/opt/llvm/svn/bin/clang-4.0+0x19a6aa8)

​23 0x00000000019a359e clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) (/opt/llvm/svn/bin/clang-4.0+0x19a359e)

​24 0x00000000019a4296 clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&) (/opt/llvm/svn/bin/clang-4.0+0x19a4296)

​25 0x00000000019a39a0 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) (/opt/llvm/svn/bin/clang-4.0+0x19a39a0)

​26 0x00000000019a3ad7 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/llvm/svn/bin/clang-4.0+0x19a3ad7)

​27 0x00000000019c5586 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&, clang::Stmt const*) (/opt/llvm/svn/bin/clang-4.0+0x19c5586)

​28 0x00000000019ce481 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/llvm/svn/bin/clang-4.0+0x19ce481)

​29 0x00000000019e6671 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/llvm/svn/bin/clang-4.0+0x19e6671)

​30 0x0000000001a044ba clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/llvm/svn/bin/clang-4.0+0x1a044ba)

​31 0x0000000001a056f8 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/llvm/svn/bin/clang-4.0+0x1a056f8)

​32 0x0000000001a05ab9 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone .part.4784] (/opt/llvm/svn/bin/clang-4.0+0x1a05ab9)

​33 0x0000000001f09103 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/llvm/svn/bin/clang-4.0+0x1f09103)

​34 0x0000000001f03cf1 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/llvm/svn/bin/clang-4.0+0x1f03cf1)

​35 0x000000000229d36e clang::ParseAST(clang::Sema&, bool, bool) (/opt/llvm/svn/bin/clang-4.0+0x229d36e)

​36 0x0000000001c6058e clang::FrontendAction::Execute() (/opt/llvm/svn/bin/clang-4.0+0x1c6058e)

​37 0x0000000001c3d7f5 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/llvm/svn/bin/clang-4.0+0x1c3d7f5)

​38 0x0000000001ce952a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/llvm/svn/bin/clang-4.0+0x1ce952a)

​39 0x00000000007f2a88 cc1_main(llvm::ArrayRef<char const>, char const, void*) (/opt/llvm/svn/bin/clang-4.0+0x7f2a88)

​40 0x000000000078aaa0 main (/opt/llvm/svn/bin/clang-4.0+0x78aaa0)

​41 0x00007f9f02690b15 __libc_start_main (/lib64/libc.so.6+0x21b15)

​42 0x00000000007ef041 _start (/opt/llvm/svn/bin/clang-4.0+0x7ef041)

Stack dump:

  1. Program arguments: /opt/llvm/svn/bin/clang-4.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name RadiationField.cc -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-file /home/tporter/Modelling/frankie/work_dir_clang/Frankie/CMakeFiles/frankie.dir/RadiationField.cc.o -resource-dir /opt/llvm/svn/bin/../lib/clang/4.0.0 -D CONFIG_PATH="/home/tporter/Install/frankie/clang/config/" -D DATA_PATH="/home/tporter/Install/frankie/clang/data/" -D ENABLE_COMPRESSION -D HAVE_ALM_HEALPIX_TOOLS_H -D HAVE_ALM_POWSPEC_TOOLS_H -D HAVE_LSCONSTANTS_H -D HAVE_WCS -D HEALPIX_STD_COMPLEX -D frankie_EXPORTS -I /home/tporter/Modelling/frankie/work_dir_clang/Frankie -I /home/tporter/Modelling/frankie/Frankie -I /home/tporter/Modelling/frankie/work_dir_clang -I /home/tporter/Modelling/frankie -I /home/tporter/Install/galtoolslib/llvm/include -I /home/tporter/Install/Healpix_3.30/src/cxx/generic_gcc/include -I /usr/local/include -I /usr/include/cfitsio -I /usr/local/lib/CLHEP-2.2.0.8/../../include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/ipp/include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/tbb/include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/daal/include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/ipp/include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/mkl/include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/tbb/include -I/opt/intel/compilers_and_libraries_2016.3.210/linux/daal/include -internal-isystem /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/../../../../include/c++/5.2.1 -internal-isystem /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/../../../../include/c++/5.2.1/x86_64-redhat-linux -internal-isystem /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.2.1/../../../../include/c++/5.2.1/backward -internal-isystem /usr/local/include -internal-isystem /opt/llvm/svn/bin/../lib/clang/4.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /home/tporter/Modelling/frankie/work_dir_clang/Frankie -ferror-limit 19 -fmessage-length 80 -fopenmp -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o CMakeFiles/frankie.dir/RadiationField.cc.o -x c++ /home/tporter/Modelling/frankie/Frankie/RadiationField.cc
  2. /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:2513:1: current parser token 'void'
  3. /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:1967:22: LLVM IR generation of declaration 'rf::RadiationField::CalculateTransientEmissivity'
  4. /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:1967:22: Generating code for declaration 'rf::RadiationField::CalculateTransientEmissivity'
  5. /home/tporter/Modelling/frankie/Frankie/RadiationField.cc:2234:10: LLVM IR generation of compound statement ('{}') clang-4.0: error: unable to execute command: Segmentation fault (core dumped) clang-4.0: error: clang frontend command failed due to signal (use -v to see invocation) clang version 4.0.0 (trunk 279502) (llvm/trunk 279635) Target: x86_64-unknown-linux-gnu Thread model: posix
zmodem commented 7 years ago

Closing since Alexey can't reproduce.

alexey-bataev commented 7 years ago

Could you try it once again with the latest trunk? Tried it and it worked without any troubles.