[flang-commits] [flang] [flang][Semantics] Adding check integer kind on STAT= specifier #230463 (PR #231103)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Mon Oct 12 18:46:38 PDT 2026
================
@@ -115,10 +115,18 @@ static void CheckTeamType(
static void CheckTeamStat(
SemanticsContext &context, const parser::ImageSelectorSpec::Stat &stat) {
const auto &var{parser::UnwrapRef<parser::Variable>(stat)};
+ auto at{parser::FindSourceLocation(var)};
if (parser::GetCoindexedNamedObject(var)) {
context.Say(parser::FindSourceLocation(var), // C931
"Image selector STAT variable must not be a coindexed "
"object"_err_en_US);
+ } else if (const auto *expr{GetExpr(context, var)}) {
+ if (auto type{expr->GetType()};
+ type && type->category() == TypeCategory::Integer &&
+ type->kind() < 2 && context.ShouldWarn(common::LanguageFeature::StatKind)) { // F2023 9.7.4 p1
+ context.Say(at,
----------------
eugeneepshteyn wrote:
Please emit this with `context.Warn(<warning>, <location of the variable>, ...)` instead of `ShouldWarn` + `Say`, here and in the two copies below. `Warn` adds the usual `[-W<name>]` tag, which these messages currently lack. Passing the variable's location also matters for the two `StatVariable` copies: they call `Say` without a location, so their caret underlines the whole statement rather than the STAT= variable.
https://github.com/llvm/llvm-project/pull/231103
More information about the flang-commits
mailing list