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

Peter Klausler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 18 10:08:58 PDT 2021


klausler added a comment.

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

> 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?

Kind suffixes are described in subclause 7.4.3 of Fortran 2018, e.g. R708 on p. 58.


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