@@ -31,19 +31,21 @@ namespace Fortran::semantics {
31
31
// - 1-element arrays being single member of COMMON
32
32
// - passed to intrinsic
33
33
// - passed to PURE procedure
34
+ // - passed to VALUE dummy argument
34
35
// - avy variable from module except
35
36
// - having attribute PARAMETER or PRIVATE
36
37
// - having DERIVED type
37
38
// - passed to intrinsic
38
39
// - passed to PURE procedure
40
+ // - passed to VALUE dummy argument
39
41
// - being arrays having 1-D rank and is not having ALLOCATABLE or POINTER or
40
42
// VOLATILE attributes
41
43
static void CheckPassGlobalVariable (
42
44
const evaluate::Expr<evaluate::SomeType> &actual,
43
45
const parser::ContextualMessages &messages, SemanticsContext &context,
44
46
evaluate::FoldingContext &foldingContext,
45
47
const evaluate::SpecificIntrinsic *intrinsic,
46
- const characteristics::Procedure *procedure) {
48
+ const characteristics::Procedure *procedure, bool dummyIsValue = false ) {
47
49
const Symbol *actualFirstSymbol{evaluate::GetFirstSymbol (actual)};
48
50
if (actualFirstSymbol) {
49
51
bool warn{false };
@@ -57,6 +59,8 @@ static void CheckPassGlobalVariable(
57
59
warn |= false ;
58
60
} else if (procedure && procedure->IsPure ()) {
59
61
warn |= false ;
62
+ } else if (dummyIsValue) {
63
+ warn |= false ;
60
64
} else if (!(actualFirstSymbol->Rank () == 1 &&
61
65
actualFirstSymbol->offset () == 0 )) {
62
66
warn |= true ;
@@ -93,6 +97,8 @@ static void CheckPassGlobalVariable(
93
97
warn |= false ;
94
98
} else if (procedure && procedure->IsPure ()) {
95
99
warn |= false ;
100
+ } else if (dummyIsValue) {
101
+ warn |= false ;
96
102
} else if (actualFirstSymbol->Rank () != 1 ) {
97
103
warn |= true ;
98
104
} else if (!actualFirstSymbol->attrs ().test (Attr::ALLOCATABLE) &&
@@ -1254,8 +1260,8 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
1254
1260
" %VAL argument must be a scalar numeric or logical expression" _err_en_US);
1255
1261
}
1256
1262
1257
- CheckPassGlobalVariable (
1258
- actual, messages, context, foldingContext, intrinsic, &procedure);
1263
+ CheckPassGlobalVariable (actual, messages, context, foldingContext, intrinsic,
1264
+ &procedure, dummyIsValue );
1259
1265
}
1260
1266
1261
1267
static void CheckProcedureArg (evaluate::ActualArgument &arg,
0 commit comments