llvm / llvm-project

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

SPEC CPU2017 fortran case 627.cam4_s crashed compile with flang #54161

Closed mollybuild closed 1 year ago

mollybuild commented 2 years ago

error information:

/home/chen/llvm-bin/bin/flang     -I/usr/include/riscv64-linux-gnu -B/usr/lib/riscv64-linux-gnu -c -o m_ExchangeMaps.fppized.o -O3 -funroll-loops -fopenmp -I/usr/lib/gcc/riscv64-linux-gnu/10/include -fallow-argument-mismatch -fopenmp m_ExchangeMaps.fppized.f90
fatal internal error: node has not been analyzed:
Expr -> FunctionReference -> Call
| ProcedureDesignator -> Name = 'globalmap_comp_id'
| ActualArgSpec
| | ActualArg -> Expr -> Designator -> DataRef -> Name = 'gmap'
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/chen/llvm-bin/bin/flang-new -fc1 -I/usr/include/riscv64-linux-gnu -fopenmp -I/usr/lib/gcc/riscv64-linux-gnu/10/include -fopenmp -module-suffix .f18.mod -fdebug-unparse -fno-analyzed-objects-for-unparse m_ExchangeMaps.fppized.f90 -o flang_unparsed_file_128282b2fda1_0.f90
#0 0x000000000086a7ea llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/chen/llvm-bin/bin/flang-new+0x86a7ea)
/home/chen/llvm-bin/bin/flang: line 409: 609176 Aborted                 (core dumped) "$wd/bin/flang-new" "${flang_options[@]}" "${fortran_source_files[$idx]}" -o "${unparsed_file_base}_${idx}.f90"
flang: in /home/chen/spec/cpu2017_install/benchspec/CPU/628.pop2_s/build/build_base_clang14-riscv64-64.0000, flang-new failed with exit status 134: /home/chen/llvm-bin/bin/flang-new -fc1 -I/usr/include/riscv64-linux-gnu -fopenmp -I/usr/lib/gcc/riscv64-linux-gnu/10/include -fopenmp -module-suffix .f18.mod -fdebug-unparse -fno-analyzed-objects-for-unparse -I/usr/include/riscv64-linux-gnu -B/usr/lib/riscv64-linux-gnu -c -o m_ExchangeMaps.fppized.o -O3 -funroll-loops -fopenmp -I/usr/lib/gcc/riscv64-linux-gnu/10/include -fallow-argument-mismatch -fopenmp m_ExchangeMaps.fppized.f90
specmake: *** [/home/chen/spec/cpu2017_install/benchspec/Makefile.defaults:386: m_ExchangeMaps.fppized.o] Error 134
specmake: *** Waiting for unfinished jobs....

Host: RISCV64 board Flang build from llvm-project source code: branch main, commit 7fd60ee Building Flang configured with:

$ cmake   -G Ninja   ../llvm   -DCMAKE_BUILD_TYPE=Release   -DFLANG_ENABLE_WERROR=On   -DLLVM_ENABLE_ASSERTIONS=ON   -DLLVM_TARGETS_TO_BUILD=host   -DCMAKE_INSTALL_PREFIX=/home/chen/llvm-bin  -DLLVM_LIT_ARGS=-v -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_RUNTIMES="compiler-rt" -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang

See m_ExchangeMaps.fppized.f90 in : https://github.com/mollybuild/RISCV-Measurement/blob/master/issues/m_ExchangeMaps.fppized.f90

llvmbot commented 2 years ago

@llvm/issue-subscribers-flang-frontend

banach-space commented 2 years ago

Hey @mollybuild , thanks for flagging this up!

Would you be able to use flang-new instead? You will have to replace -c with -fsyntax-only as code-generation is not supported yet. This should be fine for this particular bug as it's clearly failing during the semantic analysis.

Also, any chance you would be able to reduce this?

-Andrzej

mollybuild commented 2 years ago

Hey @mollybuild , thanks for flagging this up!

Would you be able to use flang-new instead? You will have to replace -c with -fsyntax-only as code-generation is not supported yet. This should be fine for this particular bug as it's clearly failing during the semantic analysis.

Also, any chance you would be able to reduce this?

-Andrzej

Hi Andrzej,

I tried flang-new with -fsyntax-only. It shows this:

cxo@0191e105f0c0:~/benchmark/cpu2017_install/benchspec/CPU/627.cam4_s/build/build_base_clang14-riscv64-64.0000$ /home/cxo/llvm-bin/bin/flang-new   -fsyntax-only -I. -Iinclude -Inetcdf/include -fopenmp m_ExchangeMaps.fppized.f90                                                                                                                                                                                                               
fatal internal error: node has not been analyzed:                                                                                                
Expr -> FunctionReference -> Call                                                                                                                
| ProcedureDesignator -> Name = 'globalmap_comp_id'                                                                                              
| ActualArgSpec                                                                                                                                  
| | ActualArg -> Expr -> Designator -> DataRef -> Name = 'gmap'                                                                                                                                                                                                                                   
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.                                      
Stack dump:                                                                                                                                      
0.      Program arguments: /home/cxo/llvm-bin/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -I . -I include -I netcdf/include -fopenmp m_ExchangeMaps.fppized.f90                                                                                                              
#0 0x0000000000c4ebb3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/cxo/llvm-bin/bin/flang-new+0xc4ebb3)                            
#1 0x0000000000c4c8ee llvm::sys::RunSignalHandlers() (/home/cxo/llvm-bin/bin/flang-new+0xc4c8ee)                                                 
#2 0x0000000000c4f1af SignalHandler(int) Signals.cpp:0:0                                                                                         
#3 0x00007fc8a52c33c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)                                                               
#4 0x00007fc8a4d5603b raise /build/glibc-sMfBJT/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1                                        
#5 0x00007fc8a4d35859 abort /build/glibc-sMfBJT/glibc-2.31/stdlib/abort.c:81:7                                                                   
#6 0x0000000001d11136 (/home/cxo/llvm-bin/bin/flang-new+0x1d11136)                                                                               
#7 0x000000000118c829 (/home/cxo/llvm-bin/bin/flang-new+0x118c829)                                                                               
#8 0x0000000001453e49 Fortran::semantics::OmpAttributeVisitor::Pre(Fortran::parser::StmtFunctionStmt const&) (/home/cxo/llvm-bin/bin/flang-new+0x1453e49)
#9 0x0000000001453789 Fortran::semantics::OmpAttributeVisitor std::__invoke_impl<void, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery>(std::variant<Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery> const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> > const&>(std::__invoke_other, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery>(std::variant<Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery> const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)&&, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> > const&) (/home/cxo/llvm-bin/bin/flang-new+0x1453789)
#10 0x0000000001441abb void Fortran::parser::ForEachInTuple<4ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x1441abb)
#11 0x0000000001441927 void Fortran::parser::ForEachInTuple<2ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x1441927)
#12 0x000000000143d114 std::enable_if<TupleTrait<Fortran::parser::SpecificationPart>, void>::type Fortran::parser::Walk<Fortran::parser::SpecificationPart, Fortran::semantics::OmpAttributeVisitor>(Fortran::parser::SpecificationPart const&, Fortran::semantics::OmpAttributeVisitor&) (/home/cxo/llvm-bin/bin/flang-new+0x143d114)
#13 0x0000000001467d20 void Fortran::parser::ForEachInTuple<1ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > >(std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x1467d20)
#14 0x00000000014685fb void Fortran::parser::ForEachInTuple<0ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > >(std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x14685fb)
#15 0x000000000142a0f6 Fortran::semantics::ResolveOmpParts(Fortran::semantics::SemanticsContext&, Fortran::parser::ProgramUnit const&) (/home/cxo/llvm-bin/bin/flang-new+0x142a0f6)
#16 0x00000000013d7175 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/home/cxo/llvm-bin/bin/flang-new+0x13d7175)
#17 0x00000000013d7e78 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/home/cxo/llvm-bin/bin/flang-new+0x13d7e78)
#18 0x000000000116a7ba Fortran::semantics::Semantics::Perform() (/home/cxo/llvm-bin/bin/flang-new+0x116a7ba)
#19 0x0000000000c99977 Fortran::frontend::FrontendAction::RunSemanticChecks() (/home/cxo/llvm-bin/bin/flang-new+0xc99977)
#20 0x0000000000e79821 Fortran::frontend::PrescanAndSemaAction::BeginSourceFileAction() (/home/cxo/llvm-bin/bin/flang-new+0xe79821)
#21 0x0000000000c98cf2 Fortran::frontend::FrontendAction::BeginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/home/cxo/llvm-bin/bin/flang-new+0xc98cf2)
#22 0x0000000000c8eb77 Fortran::frontend::CompilerInstance::ExecuteAction(Fortran::frontend::FrontendAction&) (/home/cxo/llvm-bin/bin/flang-new+0xc8eb77)
#23 0x0000000000c9ccb0 Fortran::frontend::ExecuteCompilerInvocation(Fortran::frontend::CompilerInstance*) (/home/cxo/llvm-bin/bin/flang-new+0xc9ccb0)
#24 0x0000000000bd17f6 fc1_main(llvm::ArrayRef<char const*>, char const*) (/home/cxo/llvm-bin/bin/flang-new+0xbd17f6)
#25 0x0000000000bd0422 main (/home/cxo/llvm-bin/bin/flang-new+0xbd0422)
#26 0x00007fc8a4d370b3 __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:342:3
#27 0x0000000000bd00ce _start (/home/cxo/llvm-bin/bin/flang-new+0xbd00ce)
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 15.0.0 (https://github.com/llvm/llvm-project 61e1581fa3f888a5a0800cdbdd19a45fc60d1435)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cxo/llvm-bin/bin
flang-new: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-new: note: diagnostic msg: /tmp/m_ExchangeMaps-b6565a
flang-new: note: diagnostic msg: /tmp/m_ExchangeMaps-b6565a.sh
flang-new: note: diagnostic msg:

********************

Sorry, I'm not sure what does "any chance you would be able to reduce this?" mean. Would you explain more?

banach-space commented 2 years ago

Sorry, I'm not sure what does "any chance you would be able to reduce this?" mean. Would you explain more?

As in, reduce to a smaller reproducer :) Currently, "m_ExchangeMaps.fppized.f90" is 610 lines of code and it is hard to tell what the actual issue is.

mollybuild commented 2 years ago

Hi Andrzej,

I found that this bug is caused by two factors: constant array index, and -fopenmp option. If the code contains constant array index, and compile with -fopenmp, it will encounter this error. Like the code bellow:

file m_ExchangeMaps.test.f90

module m_ExchangeMaps

      implicit none

      private   ! except

  integer, parameter :: MapTypeIndex = 2

 contains

subroutine LoadGlobalMapPars_(MapPars)

      implicit none
!
! !OUTPUT PARAMETERS:
!
      integer,         intent(out) :: MapPars(4)

  MapPars(MapTypeIndex) = 1
!  MapPars(2) = 1

 end subroutine LoadGlobalMapPars_

end module m_ExchangeMaps

compile with:

$ flang-new -fsyntax-only -o m_ExchangeMaps.test.o -fopenmp m_ExchangeMaps.test.f90

will report error:

cxo@0191e105f0c0:~/benchmark/cpu2017_install/benchspec/CPU/627.cam4_s/build/build_base_clang14-riscv64-64.0000$ /home/cxo/llvm-bin/bin/flang-new -fsyntax-only -o m_ExchangeMaps.test.o -fopenmp m_ExchangeMaps.test.f90

fatal internal error: node has not been analyzed:                                                                                                
Expr -> LiteralConstant -> IntLiteralConstant = '1'                                                                                                                                                                                                                                               
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.                                      
Stack dump:                                                                                                                                      
0.      Program arguments: /home/cxo/llvm-bin/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -fopenmp m_ExchangeMaps.test.f90  
#0 0x0000000000c4ebb3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/cxo/llvm-bin/bin/flang-new+0xc4ebb3)                            
#1 0x0000000000c4c8ee llvm::sys::RunSignalHandlers() (/home/cxo/llvm-bin/bin/flang-new+0xc4c8ee)                                                 
#2 0x0000000000c4f1af SignalHandler(int) Signals.cpp:0:0                                                                                         
#3 0x00007f14322f43c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)                                                               
#4 0x00007f1431d8703b raise /build/glibc-sMfBJT/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1                                        
#5 0x00007f1431d66859 abort /build/glibc-sMfBJT/glibc-2.31/stdlib/abort.c:81:7                                                                   
#6 0x0000000001d11136 (/home/cxo/llvm-bin/bin/flang-new+0x1d11136)                                                                               
#7 0x000000000118c829 (/home/cxo/llvm-bin/bin/flang-new+0x118c829)                                                                               
#8 0x0000000001453e49 Fortran::semantics::OmpAttributeVisitor::Pre(Fortran::parser::StmtFunctionStmt const&) (/home/cxo/llvm-bin/bin/flang-new+0x1453e49) 
 #9 0x0000000001453789 Fortran::semantics::OmpAttributeVisitor std::__invoke_impl<void, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery>(std::variant<Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery> const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> > const&>(std::__invoke_other, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery>(std::variant<Fortran::parser::SpecificationConstruct, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::DataStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::FormatStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::EntryStmt, false> >, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> >, Fortran::parser::ErrorRecovery> const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)&&, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::StmtFunctionStmt, false> > const&) (/home/cxo/llvm-bin/bin/flang-new+0x1453789)
#10 0x0000000001441abb void Fortran::parser::ForEachInTuple<4ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x1441abb)
#11 0x0000000001441927 void Fortran::parser::ForEachInTuple<2ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > >(std::tuple<std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct> >, std::__cxx11::list<Fortran::parser::OpenMPDeclarativeConstruct, std::allocator<Fortran::parser::OpenMPDeclarativeConstruct> >, std::__cxx11::list<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, std::allocator<Fortran::common::Indirection<Fortran::parser::CompilerDirective, false> > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::UseStmt, false> > > >, std::__cxx11::list<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> >, std::allocator<Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ImportStmt, false> > > >, Fortran::parser::ImplicitPart, std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct> > > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x1441927)
#12 0x000000000143d114 std::enable_if<TupleTrait<Fortran::parser::SpecificationPart>, void>::type Fortran::parser::Walk<Fortran::parser::SpecificationPart, Fortran::semantics::OmpAttributeVisitor>(Fortran::parser::SpecificationPart const&, Fortran::semantics::OmpAttributeVisitor&) (/home/cxo/llvm-bin/bin/flang-new+0x143d114)
#13 0x0000000001467d20 void Fortran::parser::ForEachInTuple<1ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > >(std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::SubroutineStmt>, Fortran::parser::SpecificationPart, Fortran::parser::ExecutionPart, std::optional<Fortran::parser::InternalSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndSubroutineStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x1467d20)
#14 0x00000000014685fb void Fortran::parser::ForEachInTuple<0ul, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&), std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > >(std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > const&, void Fortran::parser::Walk<Fortran::semantics::OmpAttributeVisitor, Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> >(std::tuple<Fortran::parser::Statement<Fortran::parser::ModuleStmt>, Fortran::parser::SpecificationPart, std::optional<Fortran::parser::ModuleSubprogramPart>, Fortran::parser::Statement<Fortran::parser::EndModuleStmt> > const&, Fortran::semantics::OmpAttributeVisitor&)::'lambda'(Fortran::semantics::OmpAttributeVisitor const&)) (/home/cxo/llvm-bin/bin/flang-new+0x14685fb)
#15 0x000000000142a0f6 Fortran::semantics::ResolveOmpParts(Fortran::semantics::SemanticsContext&, Fortran::parser::ProgramUnit const&) (/home/cxo/llvm-bin/bin/flang-new+0x142a0f6)
#16 0x00000000013d7175 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/home/cxo/llvm-bin/bin/flang-new+0x13d7175)
#17 0x00000000013d7e78 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/home/cxo/llvm-bin/bin/flang-new+0x13d7e78)
#18 0x000000000116a7ba Fortran::semantics::Semantics::Perform() (/home/cxo/llvm-bin/bin/flang-new+0x116a7ba)
#19 0x0000000000c99977 Fortran::frontend::FrontendAction::RunSemanticChecks() (/home/cxo/llvm-bin/bin/flang-new+0xc99977)
#20 0x0000000000e79821 Fortran::frontend::PrescanAndSemaAction::BeginSourceFileAction() (/home/cxo/llvm-bin/bin/flang-new+0xe79821)
#21 0x0000000000c98cf2 Fortran::frontend::FrontendAction::BeginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/home/cxo/llvm-bin/bin/flang-new+0xc98cf2)
#22 0x0000000000c8eb77 Fortran::frontend::CompilerInstance::ExecuteAction(Fortran::frontend::FrontendAction&) (/home/cxo/llvm-bin/bin/flang-new+0xc8eb77)
#23 0x0000000000c9ccb0 Fortran::frontend::ExecuteCompilerInvocation(Fortran::frontend::CompilerInstance*) (/home/cxo/llvm-bin/bin/flang-new+0xc9ccb0)
#24 0x0000000000bd17f6 fc1_main(llvm::ArrayRef<char const*>, char const*) (/home/cxo/llvm-bin/bin/flang-new+0xbd17f6)
#25 0x0000000000bd0422 main (/home/cxo/llvm-bin/bin/flang-new+0xbd0422)
#26 0x00007f1431d680b3 __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:342:3
#27 0x0000000000bd00ce _start (/home/cxo/llvm-bin/bin/flang-new+0xbd00ce)
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 15.0.0 (https://github.com/llvm/llvm-project 61e1581fa3f888a5a0800cdbdd19a45fc60d1435)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cxo/llvm-bin/bin
flang-new: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-new: note: diagnostic msg: /tmp/m_ExchangeMaps-be27e9
flang-new: note: diagnostic msg: /tmp/m_ExchangeMaps-be27e9.sh
flang-new: note: diagnostic msg:

********************

If I discard -fopenmp option or replace MapTypeIndex with its value, it will get through.

banach-space commented 2 years ago

Fantastic effort, thank you @mollybuild ! So this is clearly a bug in the OpenMP semantic checks.

@kiranchandramohan or @Leporacanthicus , would you be able to take a look? I know that both are away this week, so bear with us @mollybuild :)

llvmbot commented 2 years ago

@llvm/issue-subscribers-openmp

mollybuild commented 2 years ago

Hi,

I tested and confirm that the failure due to openmp has been fixed by https://reviews.llvm.org/D122650. But there is another semantic analysis issue. The error report is:

error: Semantic errors in seq_flds_mod.F90
./seq_flds_mod.F90:27:25: error: Actual argument type 'mct_string' is not compatible with dummy argument type 'list'
    call mct_string_clean(mctOStr)
                          ^^^^^^^

There are two clean functions defined in file m_String.F90 and m_List.F90, so some kind of mix up happened. It doesn't recognize the right one.

I put the reduced code here: https://github.com/mollybuild/RISCV-Measurement/tree/master/issue-627 Just run with make all will see the error message.

Thanks, Molly

kiranchandramohan commented 2 years ago

Thanks @mollybuild. We are working through spec2017 to fix the various issues. I did see the issue myself yesterday with pop2_s. We will get to fixing this sometime in the next few months.

The following ticket captures the high-level details with spec2017. We will be adding more details about the failures, creating separate tickets for issues etc. https://github.com/flang-compiler/f18-llvm-project/issues/1476

xgupta commented 1 year ago

Hi,

I tested and confirm that the failure due to openmp has been fixed by https://reviews.llvm.org/D122650. But there is another semantic analysis issue. The error report is:

We may close this issue in that case if 627.cam4_s compiles fine.

kiranchandramohan commented 1 year ago

OK. The semantics issues are fixed. Issue in OpenMP lowering is tracked in https://github.com/llvm/llvm-project/issues/58378.