[flang-commits] [flang] [flang] Silence errors on C_LOC/C_FUNLOC in specification expressions (PR #96108)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Jun 19 17:24:56 PDT 2024


================
@@ -82,6 +82,8 @@ auto IsVariableHelper::operator()(const Symbol &symbol) const -> Result {
   const Symbol &ultimate{symbol.GetUltimate()};
   return !IsNamedConstant(ultimate) &&
       (ultimate.has<semantics::ObjectEntityDetails>() ||
+          (ultimate.has<semantics::EntityDetails>() &&
+              ultimate.attrs().test(semantics::Attr::TARGET)) ||
----------------
klausler wrote:

It's needed to cope with the case of a host-associated entity being referenced in a specification expression in an inner or module procedure.  Name resolution must (and will) process those nested specification parts before completing the processing of the specification part of the host.  Any valid `TARGET` attribute on an `EntityDetails` symbol must denote an object, and will be converted to an `ObjectEntityDetails` symbol later.  See the original motivating test case.

(In the case of an entity with `TARGET` being referenced in a specification expression later in the same specification part, the same logic applies.)

An alternative approach would be to call `ConvertToObjectEntity()` on symbols when they acquire the `TARGET` attribute, since they can't legitimately be anything but objects at that point.

https://github.com/llvm/llvm-project/pull/96108


More information about the flang-commits mailing list