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

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 18 10:05:32 PDT 2021


awarzynski added a comment.

In D103612#2827444 <https://reviews.llvm.org/D103612#2827444>, @klausler wrote:

>> The default behaviour is to always decorate unparsed typed expression with e.g. their KIND. The new flag can be used to turn this off, so that the generated output uses valid Fortran syntax and can be fed to another Fortran compiler.
>
> The output of Expr<T>::AsFortran() should be valid Fortran, and it's a bug if it's not.

This is the output that I get from the unparser (input file: flang/test/Driver/unparse-typed-exprs.f95):

  PROGRAM test_allocated
   INTEGER :: i = 13_4
   REAL(KIND=2_4), ALLOCATABLE :: x(:)
   IF (.NOT.allocated(x)) ALLOCATE(x(i))
  END PROGRAM test_allocated

This is not valid, is it? Or am I missing something?


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