================
@@ -2756,17 +2756,32 @@ void OmpStructureChecker::Enter(const
parser::OmpDeclareMapperDirective &x) {
}
void OmpStructureChecker::Enter(const parser::OmpDeclareReductionDirective &x)
{
+ llvm::omp::Version version{context_.langOptions().getOpenMPVersion()};
+ std::string dirName{
+ GetUpperName(llvm::omp::Directive::OMPD_declare_reduction, version)};
+
const parser::OmpArgumentList &args{x.v.Arguments()};
if (args.v.size() != 1) {
context_.Say(args.source,
- "DECLARE_REDUCTION directive should have a single argument"_err_en_US);
+ "%s directive should have a single argument"_err_en_US, dirName);
return;
}
const parser::OmpArgument &arg{args.v.front()};
- if (!std::holds_alternative<parser::OmpReductionSpecifier>(arg.u)) {
+ if (auto *spec{std::get_if<parser::OmpReductionSpecifier>(&arg.u)}) {
+ auto &ident{std::get<parser::OmpReductionIdentifier>(spec->t)};
+ using IntrinsicOperator = parser::DefinedOperator::IntrinsicOperator;
+ if (auto *intOp{parser::Unwrap<IntrinsicOperator>(ident)}) {
+ if (!CheckReductionIntrinsicOperator(*intOp, arg.source)) {
----------------
kparzysz wrote:
> With this program saved as minus.f90, flang -fopenmp-simd -fopenmp-version=50
> -c minus.f90 succeeds at parent commit 04535b8c.
The `declare_reduction` is effectively ignored. If you comment it out you get
the same HLFIR as with it.
With `-fopenmp` instead of `-fopenmp-simd` the compiler crashes.
https://github.com/llvm/llvm-project/pull/232353
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits