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

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()};

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