[flang-commits] [flang] [flang][semantics] add semantic check that STAT and ERRMSG are not (de)allocated by same statement (PR #164529)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Wed Oct 22 09:02:01 PDT 2025
================
@@ -690,6 +700,20 @@ bool AllocationCheckerHelper::RunChecks(SemanticsContext &context) {
"Object in ALLOCATE must have DEVICE attribute when STREAM option is specified"_err_en_US);
}
}
+ if (allocateInfo_.gotStat && allocateInfo_.statVar) {
+ if (const Symbol *symbol{allocateInfo_.statVar->symbol};
+ symbol && *ultimate_ == symbol->GetUltimate()) {
+ context.Say(allocateInfo_.statVar->source,
+ "STAT variable in ALLOCATE must not be the variable being allocated"_err_en_US);
+ }
+ }
+ if (allocateInfo_.gotMsg && allocateInfo_.msgVar) {
----------------
klausler wrote:
You don't need to test `gotMsg`, do you?
https://github.com/llvm/llvm-project/pull/164529
More information about the flang-commits
mailing list