Skip to content

Commit fc3f92a

Browse files
committed
[flang] Fix buildbot (new warnings on old code)
The clang-aarch64-full-2stage buildbot is complaining about a warning with three instances in f18 code (none modified recently). The warning is for using the | bitwise OR operator on bool operands. In one instance, the bitwise operator was being used instead of the logical || operator in order to avoid short-circuting. The fix requires using some temporary variables. In the other two instances, the bitwise operator seemed more idiomatic in context, but can be replaced without harm with the logical operator. Pushing without review as confidence is high and nobody wants a buildbot to stay sad for long.
1 parent 4e3eebc commit fc3f92a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

flang/lib/Evaluate/tools.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -918,9 +918,9 @@ static bool CharacteristicsMatch(const characteristics::Procedure &lhs,
918918
using Attr = characteristics::Procedure::Attr;
919919
auto lhsAttrs{rhs.attrs};
920920
lhsAttrs.set(
921-
Attr::Pure, lhs.attrs.test(Attr::Pure) | rhs.attrs.test(Attr::Pure));
921+
Attr::Pure, lhs.attrs.test(Attr::Pure) || rhs.attrs.test(Attr::Pure));
922922
lhsAttrs.set(Attr::Elemental,
923-
lhs.attrs.test(Attr::Elemental) | rhs.attrs.test(Attr::Elemental));
923+
lhs.attrs.test(Attr::Elemental) || rhs.attrs.test(Attr::Elemental));
924924
return lhsAttrs == rhs.attrs && lhs.functionResult == rhs.functionResult &&
925925
lhs.dummyArguments == rhs.dummyArguments;
926926
}

flang/lib/Semantics/check-declarations.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,14 +1323,18 @@ bool CheckHelper::CheckDefinedAssignment(
13231323
} else if (proc.dummyArguments.size() != 2) {
13241324
msg = "Defined assignment subroutine '%s' must have"
13251325
" two dummy arguments"_err_en_US;
1326-
} else if (!CheckDefinedAssignmentArg(specific, proc.dummyArguments[0], 0) |
1327-
!CheckDefinedAssignmentArg(specific, proc.dummyArguments[1], 1)) {
1328-
return false; // error was reported
1329-
} else if (ConflictsWithIntrinsicAssignment(proc)) {
1330-
msg = "Defined assignment subroutine '%s' conflicts with"
1331-
" intrinsic assignment"_err_en_US;
13321326
} else {
1333-
return true; // OK
1327+
// Check both arguments even if the first has an error.
1328+
bool ok0{CheckDefinedAssignmentArg(specific, proc.dummyArguments[0], 0)};
1329+
bool ok1{CheckDefinedAssignmentArg(specific, proc.dummyArguments[1], 1)};
1330+
if (!(ok0 && ok1)) {
1331+
return false; // error was reported
1332+
} else if (ConflictsWithIntrinsicAssignment(proc)) {
1333+
msg = "Defined assignment subroutine '%s' conflicts with"
1334+
" intrinsic assignment"_err_en_US;
1335+
} else {
1336+
return true; // OK
1337+
}
13341338
}
13351339
SayWithDeclaration(specific, std::move(msg.value()), specific.name());
13361340
context_.SetError(specific);

0 commit comments

Comments
 (0)