[PATCH] D123113: [Flang] Add `INTENT` for non-dummy arguments extension

Daniil Dudkin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 05:31:07 PDT 2022

unterumarmung added a comment.

@ekieri, hello! Thank you for the comment, it is really helpful!
It turns out that I've researched the issue poorly.

Actually, `nvfortran` compiler forbids to use `INTENT` attribute on local variables, even though a "mod" file can be generated. It generates a severe error like the one below and there's no way to ignore the severe errors, if I understand correctly.

  NVFORTRAN-S-0134-Illegal attribute - intent specified for nondummy argument bar2 (test.f90: 3)

But the reason why I filed the patch was that `nvfortran` allows to use any kind of `INTENT` attribute for a local variable that marked as `RESULT` one for a function:

  function foo() result(bar)
      integer, intent(out) :: bar
  end function foo

`nvfortran` does not generate any message for this code, not even a warning. So, it looks like a bug in the compiler, not a feature or extension and this should not be supported in flang, I think.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list