Skip to content

[flang] [OpenMP] flang-new crashes with "'scf.if' op expects region #0 to have 0 or 1 blocks" #62458

@k-arrows

Description

@k-arrows
$ cat test.f90
program test
  implicit none
  integer :: x(3), i
  !$omp parallel do lastprivate(x)
  do i = 1, 10
    x = (/ i, i, i /)
  end do

  if (any(x /= (/ 10, 10, 10 /))) stop 1
end program

Error message:

$ flang-new -fopenmp test.f90
error: loc("./test.f90":1:1): 'scf.if' op expects region #0 to have 0 or 1 blocks
error: Lowering to LLVM IR failed
error: loc("./test.f90":1:1): cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: func.func

Stack dump:

 #0 0x0000559e595ec638 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
 #1 0x0000559e595ea5ae llvm::sys::RunSignalHandlers()
 #2 0x0000559e595ecf68 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fa34ea3e520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000559e5cb1e2b9 llvm::Module::setPICLevel(llvm::PICLevel::Level)
 #5 0x0000559e597f72a0 Fortran::frontend::CodeGenAction::generateLLVMIR()
 #6 0x0000559e597f9280 Fortran::frontend::CodeGenAction::executeAction()
 #7 0x0000559e59619c5c Fortran::frontend::FrontendAction::execute()
 #8 0x0000559e5960cdce Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&)
 #9 0x0000559e5961cfde Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*)
#10 0x0000559e5857df21 fc1_main(llvm::ArrayRef<char const*>, char const*)
#11 0x0000559e5857bf66 main
#12 0x00007fa34ea25d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#13 0x00007fa34ea25e40 call_init ./csu/../csu/libc-start.c:128:20
#14 0x00007fa34ea25e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#15 0x0000559e5857b995 _start
flang-new: error: unable to execute command: Segmentation fault
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 16.0.2 (https://github.com/llvm/llvm-project 18ddebe1a1a9bde349441631365f0472e9693520)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Program arguments:

flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -fopenmp -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -o /tmp/test-709e43.o -x f95-cpp-input test.f90

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]flang:iropenmp

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions