[flang-commits] [PATCH] D123873: [flang] Finer control over error recovery with GetExpr()

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Apr 15 13:27:18 PDT 2022


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

Prior to this patch, the semantics utility GetExpr() will crash
unconditionally if it encounters a typed expression in the parse
tree that has not been set by expression semantics.  This is the
right behavior when called from lowering, by which time it is known
that the program had no fatal user errors, since it signifies a
fatal internal error.  However, prior to lowering, in the statement
semantics checking code, a more nuanced test should be used before
crashing -- specifically, we should not crash in the face of a
missing typed expression when in error recovery mode.

Getting this right requires GetExpr() and its helper class to have
access to the semantics context, so that it can check AnyFatalErrors()
before crashing.  So this patch touches nearly all of its call sites.


https://reviews.llvm.org/D123873

Files:
  flang/include/flang/Semantics/tools.h
  flang/lib/Semantics/assignment.cpp
  flang/lib/Semantics/check-allocate.cpp
  flang/lib/Semantics/check-arithmeticif.cpp
  flang/lib/Semantics/check-case.cpp
  flang/lib/Semantics/check-coarray.cpp
  flang/lib/Semantics/check-deallocate.cpp
  flang/lib/Semantics/check-do-forall.cpp
  flang/lib/Semantics/check-io.cpp
  flang/lib/Semantics/check-io.h
  flang/lib/Semantics/check-nullify.cpp
  flang/lib/Semantics/check-omp-structure.cpp
  flang/lib/Semantics/check-stop.cpp
  flang/lib/Semantics/data-to-inits.cpp
  flang/lib/Semantics/resolve-directives.cpp
  flang/lib/Semantics/tools.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123873.423158.patch
Type: text/x-patch
Size: 20025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220415/b1f07041/attachment-0001.bin>


More information about the flang-commits mailing list