<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66453>66453</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Compilation error of `declare reduction` directive
</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 `declare reduction` directive.
(Probably it has not been implemented yet.)
The following are the test program, Flang-new and gfortran compilation result.
```fortran
! test.f90
!$omp declare reduction(ior:real(4):omp_out=omp_in+omp_out)
end
```
```console
$ flang-new -v test.f90 -fopenmp
flang-new version 18.0.0 (https://github.com/llvm/llvm-project.git 444abb396c340e52a8a4db5778b7d6b3b6195070)
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 /tmp/test-fdc0ba.o -x f95-cpp-input test.f90
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 /tmp/test-fdc0ba.o -x f95-cpp-input test.f90
#0 0x0000ffffa6975f60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/path/to/install/bin/../lib/libLLVMSupport.so.18git+0x1a5f60)
#1 0x0000ffffa6973b40 llvm::sys::RunSignalHandlers() (/path/to/install/bin/../lib/libLLVMSupport.so.18git+0x1a3b40)
#2 0x0000ffffa6973cb0 SignalHandler(int) Signals.cpp:0:0
#3 0x0000ffffa845066c (linux-vdso.so.1+0x66c)
#4 0x0000ffffa6352dbc raise (/lib64/libc.so.6+0x32dbc)
#5 0x0000ffffa6340928 abort (/lib64/libc.so.6+0x20928)
#6 0x0000ffffa28395d0 Fortran::evaluate::ExpressionAnalyzer::IntegerTypeSpecKind(Fortran::parser::IntegerTypeSpec const&) (/path/to/install/bin/../lib/../lib/libFortranSemantics.so.18git+0x4295d0)
#7 0x0000ffffa28f59c4 Fortran::semantics::ScopeHandler::MakeNumericType(Fortran::common::TypeCategory, std::optional<Fortran::parser::KindSelector> const&) (/path/to/install/bin/../lib/../lib/libFortranSemantics.so.18git+0x4e59c4)
#8 0x0000ffffa291ba64 void Fortran::parser::Walk<Fortran::semantics::ResolveNamesVisitor>(Fortran::parser::IntrinsicTypeSpec::Real const&, Fortran::semantics::ResolveNamesVisitor&) (/path/to/install/bin/../lib/../lib/libFortranSemantics.so.18git+0x50ba64)
#9 0x0000ffffa2927e5c void Fortran::parser::ForEachInTuple<1ul, void Fortran::parser::Walk<Fortran::semantics::ResolveNamesVisitor, Fortran::parser::Verbatim, Fortran::parser::OmpReductionOperator, std::__cxx11::list<Fortran::parser::DeclarationTypeSpec, std::allocator<Fortran::parser::DeclarationTypeSpec>>, Fortran::parser::OmpReductionCombiner, std::optional<Fortran::parser::OmpReductionInitializerClause>>(std::tuple<Fortran::parser::Verbatim, Fortran::parser::OmpReductionOperator, std::__cxx11::list<Fortran::parser::DeclarationTypeSpec, std::allocator<Fortran::parser::DeclarationTypeSpec>>, Fortran::parser::OmpReductionCombiner, std::optional<Fortran::parser::OmpReductionInitializerClause>> const&, Fortran::semantics::ResolveNamesVisitor&)::'lambda'(Fortran::semantics::ResolveNamesVisitor const&), std::tuple<Fortran::parser::Verbatim, Fortran::parser::OmpReductionOperator, std::__cxx11::list<Fortran::parser::DeclarationTypeSpec, std::allocator<Fortran::parser::DeclarationTypeSpec>>, Fortran::parser::OmpReductionCombiner, std::optional<Fortran::parser::OmpReductionInitializerClause>>>(std::tuple<Fortran::parser::Verbatim, Fortran::parser::OmpReductionOperator, std::__cxx11::list<Fortran::parser::DeclarationTypeSpec, std::allocator<Fortran::parser::DeclarationTypeSpec>>, Fortran::parser::OmpReductionCombiner, std::optional<Fortran::parser::OmpReductionInitializerClause>> const&, void Fortran::parser::Walk<Fortran::semantics::ResolveNamesVisitor, Fortran::parser::Verbatim, Fortran::parser::OmpReductionOperator, std::__cxx11::list<Fortran::parser::DeclarationTypeSpec, std::allocator<Fortran::parser::DeclarationTypeSpec>>, Fortran::parser::OmpReductionCombiner, std::optional<Fortran::parser::OmpReductionInitializerClause>>(std::tuple<Fortran::parser::Verbatim, Fortran::parser::OmpReductionOperator, std::__cxx11::list<Fortran::parser::DeclarationTypeSpec, std::allocator<Fortran::parser::DeclarationTypeSpec>>, Fortran::parser::OmpReductionCombiner, std::optional<Fortran::parser::OmpReductionInitializerClause>> const&, Fortran::semantics::ResolveNamesVisitor&)::'lambda'(Fortran::semantics::ResolveNamesVisitor const&)) (/path/to/install/bin/../lib/../lib/libFortranSemantics.so.18git+0x517e5c)
#10 0x0000ffffa2933a7c Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::SpecificationPart const&) (/path/to/install/bin/../lib/../lib/libFortranSemantics.so.18git+0x523a7c)
#11 0x0000ffffa2953e4c Fortran::semantics::ResolveNamesVisitor::ResolveSpecificationParts(Fortran::semantics::ProgramTree&) (.part.0) resolve-names.cpp:0:0
#12 0x0000ffffa29543b0 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (.part.0) resolve-names.cpp:0:0
#13 0x0000ffffa2955398 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/path/to/install/bin/../lib/../lib/libFortranSemantics.so.18git+0x545398)
#14 0x0000ffffa29c7b64 Fortran::semantics::Semantics::Perform() (/path/to/install/bin/../lib/../lib/libFortranSemantics.so.18git+0x5b7b64)
#15 0x0000ffffa7593314 Fortran::frontend::FrontendAction::runSemanticChecks() (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x53314)
#16 0x0000ffffa765d2d0 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x11d2d0)
#17 0x0000ffffa7594e30 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x54e30)
#18 0x0000ffffa75841f0 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x441f0)
#19 0x0000ffffa7ae3bbc Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/path/to/install/bin/../lib/libflangFrontendTool.so.18git+0x3bbc)
#20 0x00000000004048dc fc1_main(llvm::ArrayRef<char const*>, char const*) (/path/to/install/bin/flang-new+0x4048dc)
#21 0x0000000000403108 main (/path/to/install/bin/flang-new+0x403108)
#22 0x0000ffffa6340d64 __libc_start_main (/lib64/libc.so.6+0x20d64)
#23 0x00000000004035d0 _start (/path/to/install/bin/flang-new+0x4035d0)
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 18.0.0 (https://github.com/llvm/llvm-project.git 444abb396c340e52a8a4db5778b7d6b3b6195070)
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-239fff
flang-new: note: diagnostic msg: /tmp/test-239fff.sh
flang-new: note: diagnostic msg:
********************
```
```console
$ gfortran -v test.f90 -fopenmp
Driving: gfortran -v test.f90 -fopenmp -l gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/8/lto-wrapper
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/eJzsWltz4yiw_jXkhcIlIfn2kAfHjmemTnaTSry7jymEWjIzCHQAJc78-lMg-SJP7jOzu3V2Uk5iLmq-r7tpEDSzVpQK4BQNz9BwccIat9bm9KGxyTiOSPH5JNP5w-lqLSwWFjOFhbUN4MLoCi-bz8LZBjuwzjbCwQBFCxTN2r9LyVRJFNxjB6YSijmwmGVKm4pJ-YDv16Aw11UtpFAlRqMoBy6ZAWwgb7gTWqFRhHNhgDtxtxNOJ1dGZyyTD1g4vGYWK-1wBqCwqGoJFSgHOX4AN0B0eohotQZcaCn1vR_Qj-TWENDj2ujSsArROd7jZirHZaGNM2yLlHlY2IBtpOuxRaOo_XT9t2DjIH9QTKNdDaKprmr8LVs6EdqgZGaASUQnqYefzHRV3-rGoWThvwmF6Nm2aksPVH6E4qjItbJawhZCiosdSXK3Q4hJoWtQVd322_e5A2M973gyiAYRRnSydq62KJkhukR0WQq3brIB1xWiSynvtv9IbfRn4G5QCofTNGV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