[flang-dev] [f18]How to check if a variable was initialised in f18.

Caroline Concatto via flang-dev flang-dev at lists.llvm.org
Wed Nov 27 03:07:04 PST 2019


Hi all,

I don’t know if anyone can help. Probably with more info.
But worth a shot, as a start.

How do I check if a variable was initialized in F18 when my method only receives symbol? Is it possible?

I’ve tried the code bellow, but it gives me segmentation fault.

//F18 function in resolve-names.cc
void ResolveNamesVisitor::FinishSpecificationPart() {
….
  for (auto &pair : currScope()) {
     auto &symbol{*pair.second};
     ….
     CheckInitialization(symbol);
  }
}

void DeclarationVisitor::CheckInitialization(const Symbol &symbol) {
          const auto *object{symbol.detailsIf<ObjectEntityDetails>()};
          if (object->init().has_value()) {
                       Say(symbol.name(),
                                     " Element '%s' was initialized"_err_en_US);

   }
}

By looking at the source code it looks like I need to reference to name, something like symbol.name(), but that does not work.

Thank you,

Carol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20191127/346761bc/attachment-0001.html>


More information about the flang-dev mailing list