[PATCH] D84969: [flang] Fix an assert on duplicate initializations

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 11:56:46 PDT 2020


klausler accepted this revision.
klausler added inline comments.
This revision is now accepted and ready to land.


================
Comment at: flang/lib/Semantics/resolve-names.cpp:5669
     Symbol &ultimate{name.symbol->GetUltimate()};
-    if (IsPointer(ultimate)) {
-      Say(name, "'%s' is a pointer but is not initialized like one"_err_en_US);
-    } else if (auto *details{ultimate.detailsIf<ObjectEntityDetails>()}) {
-      CHECK(!details->init());
-      Walk(expr);
-      // TODO: check C762 - all bounds and type parameters of component
-      // are colons or constant expressions if component is initialized
-      if (inComponentDecl) {
-        // Can't convert to type of component, which might not yet
-        // be known; that's done later during instantiation.
-        if (MaybeExpr value{EvaluateExpr(expr)}) {
-          details->set_init(std::move(*value));
+    if (!context().HasError(ultimate)) {
+      if (IsPointer(ultimate)) {
----------------
Might be more clear as `if (context().HasError(ultimate)) { } else if (auto *details...)`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84969/new/

https://reviews.llvm.org/D84969



More information about the llvm-commits mailing list