@@ -674,26 +674,28 @@ void AccStructureChecker::Enter(const parser::AccClause::Reduction &reduction) {
674
674
common::visitors{
675
675
[&](const parser::Designator &designator) {
676
676
if (const auto *name = getDesignatorNameIfDataRef (designator)) {
677
- const auto *type{name->symbol ->GetType ()};
678
- if (type->IsNumeric (TypeCategory::Integer) &&
679
- !reductionIntegerSet.test (op.v )) {
680
- context_.Say (GetContext ().clauseSource ,
681
- " reduction operator not supported for integer type" _err_en_US);
682
- } else if (type->IsNumeric (TypeCategory::Real) &&
683
- !reductionRealSet.test (op.v )) {
684
- context_.Say (GetContext ().clauseSource ,
685
- " reduction operator not supported for real type" _err_en_US);
686
- } else if (type->IsNumeric (TypeCategory::Complex) &&
687
- !reductionComplexSet.test (op.v )) {
688
- context_.Say (GetContext ().clauseSource ,
689
- " reduction operator not supported for complex type" _err_en_US);
690
- } else if (type->category () ==
691
- Fortran::semantics::DeclTypeSpec::Category::Logical &&
692
- !reductionLogicalSet.test (op.v )) {
693
- context_.Say (GetContext ().clauseSource ,
694
- " reduction operator not supported for logical type" _err_en_US);
677
+ if (name->symbol ) {
678
+ const auto *type{name->symbol ->GetType ()};
679
+ if (type->IsNumeric (TypeCategory::Integer) &&
680
+ !reductionIntegerSet.test (op.v )) {
681
+ context_.Say (GetContext ().clauseSource ,
682
+ " reduction operator not supported for integer type" _err_en_US);
683
+ } else if (type->IsNumeric (TypeCategory::Real) &&
684
+ !reductionRealSet.test (op.v )) {
685
+ context_.Say (GetContext ().clauseSource ,
686
+ " reduction operator not supported for real type" _err_en_US);
687
+ } else if (type->IsNumeric (TypeCategory::Complex) &&
688
+ !reductionComplexSet.test (op.v )) {
689
+ context_.Say (GetContext ().clauseSource ,
690
+ " reduction operator not supported for complex type" _err_en_US);
691
+ } else if (type->category () ==
692
+ Fortran::semantics::DeclTypeSpec::Category::Logical &&
693
+ !reductionLogicalSet.test (op.v )) {
694
+ context_.Say (GetContext ().clauseSource ,
695
+ " reduction operator not supported for logical type" _err_en_US);
696
+ }
697
+ // TODO: check composite type.
695
698
}
696
- // TODO: check composite type.
697
699
}
698
700
},
699
701
[&](const Fortran::parser::Name &name) {
0 commit comments