@@ -983,24 +983,26 @@ void AccStructureChecker::Enter(const parser::AccClause::Reduction &reduction) {
983
983
[&](const parser::Designator &designator) {
984
984
if (const auto *name = getDesignatorNameIfDataRef (designator)) {
985
985
if (name->symbol ) {
986
- const auto *type{name->symbol ->GetType ()};
987
- if (type->IsNumeric (TypeCategory::Integer) &&
988
- !reductionIntegerSet.test (op.v )) {
989
- context_.Say (GetContext ().clauseSource ,
990
- " reduction operator not supported for integer type" _err_en_US);
991
- } else if (type->IsNumeric (TypeCategory::Real) &&
992
- !reductionRealSet.test (op.v )) {
993
- context_.Say (GetContext ().clauseSource ,
994
- " reduction operator not supported for real type" _err_en_US);
995
- } else if (type->IsNumeric (TypeCategory::Complex) &&
996
- !reductionComplexSet.test (op.v )) {
997
- context_.Say (GetContext ().clauseSource ,
998
- " reduction operator not supported for complex type" _err_en_US);
999
- } else if (type->category () ==
1000
- Fortran::semantics::DeclTypeSpec::Category::Logical &&
1001
- !reductionLogicalSet.test (op.v )) {
1002
- context_.Say (GetContext ().clauseSource ,
1003
- " reduction operator not supported for logical type" _err_en_US);
986
+ if (const auto *type{name->symbol ->GetType ()}) {
987
+ if (type->IsNumeric (TypeCategory::Integer) &&
988
+ !reductionIntegerSet.test (op.v )) {
989
+ context_.Say (GetContext ().clauseSource ,
990
+ " reduction operator not supported for integer type" _err_en_US);
991
+ } else if (type->IsNumeric (TypeCategory::Real) &&
992
+ !reductionRealSet.test (op.v )) {
993
+ context_.Say (GetContext ().clauseSource ,
994
+ " reduction operator not supported for real type" _err_en_US);
995
+ } else if (type->IsNumeric (TypeCategory::Complex) &&
996
+ !reductionComplexSet.test (op.v )) {
997
+ context_.Say (GetContext ().clauseSource ,
998
+ " reduction operator not supported for complex type" _err_en_US);
999
+ } else if (type->category () ==
1000
+ Fortran::semantics::DeclTypeSpec::Category::
1001
+ Logical &&
1002
+ !reductionLogicalSet.test (op.v )) {
1003
+ context_.Say (GetContext ().clauseSource ,
1004
+ " reduction operator not supported for logical type" _err_en_US);
1005
+ }
1004
1006
}
1005
1007
// TODO: check composite type.
1006
1008
}
0 commit comments