llvm / llvm-project

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

[Flang][OpenMP] fatal internal error: CHECK(IsValid(*range)) failed at /root/llvm-project/flang/lib/Parser/provenance.cpp(279) #107502

Open k-arrows opened 2 months ago

k-arrows commented 2 months ago

Reproducible on Godbolt: https://godbolt.org/z/8sM9f16aT

Reproducer:

integer :: i

!$omp do simd
do i = 1, 10
   !$omp parallel sections
   !$omp end parallel sections
end do
!$omp end do simd

end

Stack dump:

Stack dump:
0.  Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -S -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -fopenmp -resource-dir /opt/compiler-explorer/clang-llvmflang-trunk-20240905/lib/clang/20 -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #0 0x000000000351f9c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x351f9c8)
 #1 0x000000000351d36c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007772af642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007772af6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007772af642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007772af6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000004b3fd19 (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x4b3fd19)
 #7 0x00000000047eb14b Fortran::parser::AllSources::EmitMessage(llvm::raw_ostream&, std::optional<Fortran::common::Interval<Fortran::parser::Provenance>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, llvm::raw_ostream::Colors, bool) const (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x47eb14b)
 #8 0x000000000475fdca Fortran::parser::Message::Emit(llvm::raw_ostream&, Fortran::parser::AllCookedSources const&, bool) const (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x475fdca)
 #9 0x00000000047635e9 Fortran::parser::Messages::Emit(llvm::raw_ostream&, Fortran::parser::AllCookedSources const&, bool) const (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x47635e9)
#10 0x00000000035771d2 Fortran::frontend::FrontendAction::reportFatalSemanticErrors() (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x35771d2)
#11 0x00000000035773f5 Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x35773f5)
#12 0x00000000038ad46a Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x38ad46a)
#13 0x00000000035767f5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x35767f5)
#14 0x0000000003565df7 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x3565df7)
#15 0x000000000357c83d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x357c83d)
#16 0x0000000001c13278 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x1c13278)
#17 0x0000000001af438c main (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x1af438c)
#18 0x00007772af629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#19 0x00007772af629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#20 0x0000000001c121de _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x1c121de)
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 20.0.0git (https://github.com/llvm/llvm-project.git 1254259e325428c5912843aa94f6fc663a40ea1b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin
llvmbot commented 2 months ago

@llvm/issue-subscribers-flang-frontend

Author: None (k-arrows)

Reproducible on Godbolt: https://godbolt.org/z/8sM9f16aT Reproducer: ```f90 integer :: i !$omp do simd do i = 1, 10 !$omp parallel sections !$omp end parallel sections end do !$omp end do simd end ``` Stack dump: ```console Stack dump: 0. Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -S -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -fopenmp -resource-dir /opt/compiler-explorer/clang-llvmflang-trunk-20240905/lib/clang/20 -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90 #0 0x000000000351f9c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x351f9c8) #1 0x000000000351d36c SignalHandler(int) Signals.cpp:0:0 #2 0x00007772af642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #3 0x00007772af6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #4 0x00007772af642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #5 0x00007772af6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #6 0x0000000004b3fd19 (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x4b3fd19) #7 0x00000000047eb14b Fortran::parser::AllSources::EmitMessage(llvm::raw_ostream&, std::optional<Fortran::common::Interval<Fortran::parser::Provenance>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, llvm::raw_ostream::Colors, bool) const (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x47eb14b) #8 0x000000000475fdca Fortran::parser::Message::Emit(llvm::raw_ostream&, Fortran::parser::AllCookedSources const&, bool) const (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x475fdca) #9 0x00000000047635e9 Fortran::parser::Messages::Emit(llvm::raw_ostream&, Fortran::parser::AllCookedSources const&, bool) const (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x47635e9) #10 0x00000000035771d2 Fortran::frontend::FrontendAction::reportFatalSemanticErrors() (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x35771d2) #11 0x00000000035773f5 Fortran::frontend::FrontendAction::runSemanticChecks() (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x35773f5) #12 0x00000000038ad46a Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x38ad46a) #13 0x00000000035767f5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x35767f5) #14 0x0000000003565df7 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x3565df7) #15 0x000000000357c83d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x357c83d) #16 0x0000000001c13278 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x1c13278) #17 0x0000000001af438c main (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x1af438c) #18 0x00007772af629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #19 0x00007772af629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #20 0x0000000001c121de _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin/flang-new+0x1c121de) 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 20.0.0git (https://github.com/llvm/llvm-project.git 1254259e325428c5912843aa94f6fc663a40ea1b) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240905/bin ```