Skip to content

Commit f537972

Browse files
Added DefinabilityFlag::VolatileNotDefinable
1 parent 2d51b20 commit f537972

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

flang/lib/Semantics/check-call.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,8 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
734734
characteristics::DummyDataObject::Attr::Asynchronous)) {
735735
undefinableMessage =
736736
"Actual argument associated with ASYNCHRONOUS %s is not definable"_warn_en_US;
737-
} else if (dummy.attrs.test(
738-
characteristics::DummyDataObject::Attr::Volatile)) {
737+
} else if (dummyIsVolatile) {
738+
flags.set(DefinabilityFlag::VolatileNotDefinable);
739739
undefinableMessage =
740740
"Actual argument associated with VOLATILE %s is not definable"_warn_en_US;
741741
}

flang/lib/Semantics/definable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ std::optional<parser::Message> WhyNotDefinable(parser::CharBlock at,
371371
return parser::Message{at,
372372
"Variable '%s' has a vector subscript"_err_en_US, expr.AsFortran()};
373373
}
374-
} else if (evaluate::HasTriplet(expr)) {
374+
} else if (flags.test(DefinabilityFlag::VolatileNotDefinable) &&
375+
evaluate::HasTriplet(expr)) {
375376
return parser::Message{at,
376377
"Variable '%s' has array section"_err_en_US, expr.AsFortran()};
377378
}

flang/lib/Semantics/definable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ENUM_CLASS(DefinabilityFlag,
3333
SourcedAllocation, // ALLOCATE(a,SOURCE=)
3434
PolymorphicOkInPure, // don't check for polymorphic type in pure subprogram
3535
DoNotNoteDefinition, // context does not imply definition
36-
AllowEventLockOrNotifyType, PotentialDeallocation)
36+
AllowEventLockOrNotifyType, PotentialDeallocation, VolatileNotDefinable)
3737

3838
using DefinabilityFlags =
3939
common::EnumSet<DefinabilityFlag, DefinabilityFlag_enumSize>;

0 commit comments

Comments
 (0)