<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65570>65570</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Compilation error of `ordered` clause not in DO loops
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue,
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yus3710-fj
</td>
</tr>
</table>
<pre>
This is an issue from Fujitsu testsuite.
Flang-new terminates abnormally when compiling `ordered` clause not in DO loops.
The following are the test program, Flang-new and gfortran compilation result.
```fortran
! test.f90
subroutine sub()
implicit none
integer::i
integer::k=0
!$omp ordered
do i=1,1
k=k+1
enddo
!$omp end ordered
end
```
```console
$ flang-new -v test.f90 -c -fopenmp
flang-new version 18.0.0 (https://github.com/llvm/llvm-project.git 701e6f7630474b637e0bc45d009bf2ec47f2d3fd)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/install/bin
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/8
Selected GCC installation: /usr/lib/gcc/aarch64-redhat-linux/8
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/path/to/install/bin/flang-new" -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenmp -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +neon -target-feature +v8a -o test.o -x f95-cpp-input test.f90
error: loc("/path/to/test.f90":6:1): failed to legalize operation 'cf.br'
error: Lowering to LLVM IR failed
error: loc("/path/to/test.f90":1:1): cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: func.func
error: failed to create the LLVM module
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /path/to/install/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenmp -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +neon -target-feature +v8a -o test.o -x f95-cpp-input test.f90
#0 0x0000ffff87285f60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/path/to/install/bin/../lib/libLLVMSupport.so.18git+0x1a5f60)
#1 0x0000ffff87283b40 llvm::sys::RunSignalHandlers() (/path/to/install/bin/../lib/libLLVMSupport.so.18git+0x1a3b40)
#2 0x0000ffff87283cb0 SignalHandler(int) Signals.cpp:0:0
#3 0x0000ffff88d6066c (linux-vdso.so.1+0x66c)
#4 0x0000ffff87f702c0 Fortran::frontend::CodeGenAction::executeAction() (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x1202c0)
#5 0x0000ffff87ea2b2c Fortran::frontend::FrontendAction::execute() (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x52b2c)
#6 0x0000ffff87e943c4 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x443c4)
#7 0x0000ffff883f3bbc Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/path/to/install/bin/../lib/libflangFrontendTool.so.18git+0x3bbc)
#8 0x00000000004048dc fc1_main(llvm::ArrayRef<char const*>, char const*) (/path/to/install/bin/flang-new+0x4048dc)
#9 0x0000000000403108 main (/path/to/install/bin/flang-new+0x403108)
#10 0x0000ffff86c50d64 __libc_start_main (/lib64/libc.so.6+0x20d64)
#11 0x00000000004035d0 _start (/path/to/install/bin/flang-new+0x4035d0)
flang-new: error: unable to execute command: Segmentation fault (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 18.0.0 (https://github.com/llvm/llvm-project.git 701e6f7630474b637e0bc45d009bf2ec47f2d3fd)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/install/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/test-506a7f
flang-new: note: diagnostic msg: /tmp/test-506a7f.sh
flang-new: note: diagnostic msg:
********************
```
```console
$ gfortran -v test.f90 -c -fopenmp
Using built-in specs.
COLLECT_GCC=gfortran
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-gnu-indirect-function --build=aarch64-redhat-linux
Thread model: posix
gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
:
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWF9z4ygS_zTkpQsXRrJsP-TBseOZqcpepibZu8cUQi2ZCQIdoPzZT38Fku3YO5udm5m3TTmJ1YLm103z66aF96oxiJdkdkVmmwvRh511l6-9z-ZTRuuvF6WtXi_vd8qD8iAMKO97hNrZFrb9VxV8DwF98L0KOCFsQ9hq-LvVwjTU4DMEdK0yIqAHURrrWqH1Kzzv0IC0bae0Mg2QgllXocOKFAykFr1HMDaAMrC5BW1t50_03-8Qaqu1fY7ThUMIO0xYoHO2caIlfA1HFMJU0NTWBSf264qgrAGHvtfhRDcp2PAZx49SPk36J_WSDRLfl872QRkE35eELwhfDm9U22klVQBjDY4iE7BBR7IVyVbqG7JHkm3YYSnCc9t2MDoFBnllQZFsMyV8PR0kcdIj4VfjI5qqsuc60FR7PYdRZ4aePUprvNW4V5RDffAjfTo4AagEWtsOTdsNQ4_DntD56N3pYsImDAhf7ELofLSUbwnfNirs-nIibUv4Vuun_T_aOfsVZZg0KsCcTbGo50XG8nleFtkcWSnzWcXYsqw5ynxe8yqrq4Pb74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