[PATCH] D145845: [Flang] Allow compile *.f03, *.f08 file

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 11 07:01:04 PST 2023


awarzynski added a comment.

In D145845#4186608 <https://reviews.llvm.org/D145845#4186608>, @clementval wrote:

> In D145845#4186607 <https://reviews.llvm.org/D145845#4186607>, @awarzynski wrote:
>
>> Thanks!
>>
>> In D145845#4186590 <https://reviews.llvm.org/D145845#4186590>, @clementval wrote:
>>
>>> Thanks. Can you add tests in `flang/test/Driver`?
>>
>> Hm, this is a `clangDriver` change rather than anything Flang specific 🤔 . Btw, how does https://github.com/llvm/llvm-project/issues/61260 manifest to you? I'm trying to figure out how to best test it (I couldn't find any other tests for this specifically).
>
> Cannot we just have a a .f03 file and compile it and see if we have an executable?

We don't really build executable for testing the Driver. Also, building an executable involves many steps:

1. The driver (`flang-new`) identifies the file as a valid Fortran file. Delegates to "Flang" for the next step.
2. "Flang" parses the input, runs semantic checks and lowers to LLVM IR. This is driven by the frontend driver, `flang-new -fc1`.
3. LLVM IR is compiled into machine code (via LLVM) (also driven by `flang-new -fc1`).
4. Machine code generated in 3 is then linked by the driver to generate an executable (this step is driven by `flang-new`).

  It would be good to understand what exactly this change unblocks and then test that specifically. To me it sounds like this change is only really needed for 1. and hence we should only be testing 1 and avoid doing extra work that's not needed.

I suspect that without this change, `.*.f03` files are recognized as object rather than Fortran files and hence step 1. is followed by step 4. rather than step 2. So, try `flang-new -### file.f03` **with** and **without** your change. You should see that **with** this change you do see the frontend driver invocation  (`flang-new -fc1 <some args>`) that would run steps 2 and 3.. IMO that's the only thing that requires verifying here.

Does this make sense?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145845



More information about the cfe-commits mailing list