[PATCH] D103612: [flang][driver] Add `-funparse-typed-exprs-as-fortran`

Peter Klausler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 21 09:38:16 PDT 2021


klausler added a comment.

In D103612#2830111 <https://reviews.llvm.org/D103612#2830111>, @awarzynski wrote:

> In D103612#2827468 <https://reviews.llvm.org/D103612#2827468>, @klausler wrote:
>
>> Kind suffixes are described in subclause 7.4.3 of Fortran 2018, e.g. R708 on p. 58.
>
> Many thanks for this reference.
>
> So when calling `Unparse,` one specifes `AnalyzedObjectsAsFortran` (i.e. the optional last argument) to get more semantic context in the dump, right?

It's for better code coverage when testing.  When the internal representations of expressions & variables are dumped by unparsing rather than the original parse trees, it allows semantic analysis (esp. folding) to be exercised.  If an unparsed program compiles and runs fine when unparsed into gfortran without this flag, but fails when the flag is present, there's a bug.  This feature allows much of the frontend to undergo some testing and debugging in the absence of a code generator.

It's also useful for self-testing via a "parse/unparse/reparse/unparse" mode, in which we recompile unparsed Fortran and check that it unparses to the same output.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103612



More information about the cfe-commits mailing list