[PATCH] D118618: [flang] Fix invalid diagnostics in wrapper and reduce code dup.

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 05:12:10 PST 2022


awarzynski added a comment.

In D118618#3289948 <https://reviews.llvm.org/D118618#3289948>, @ygribov wrote:

> We are just trying to figure out the status of flang's frontend at the moment

Why not use `flang-new` for this? The main difference between `flang-new` and `flang` is that the latter calls an external Fortran compiler to compile the unparsed source files. If you do need code-generation, then that's available on fir-dev <https://github.com/flang-compiler/f18-llvm-project/tree/fir-dev>. We've been using it to compile e.g. SNAP <https://github.com/lanl/SNAP> (i.e. the driver is already fairly capable).

> If you believe that this is not really useful, I'll keep flang fixes in our local branch.

All improvements are useful. But we have no upstream testing for this script and a few downstream users to rely on this. Personally, I'd love for everyone to switch to `flang-new` instead. And if there's anything that's missing in `flang-new` that prevents people from switching, it would be good to identify such blockers.

> As a side note, what is the plan about merging codegen into main?

It's work-in-progress. We'd like it to happen ASAP. As for the driver itself, I want to start moving code-gen patches from `fir-dev` onto `main` in the coming days. I just keep getting distracted :-)



================
Comment at: flang/tools/f18/flang:319
-    then status=$?
-         echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2
-         exit $status
----------------
ygribov wrote:
> awarzynski wrote:
> > This seems to be the only place in which the diagnostic is inconsistent with the compiler invocation (should be `$ect_fc` instead of `"$wd/bin/flang-new"`).
> Not quite, I believe command-line arguments are wrong in practically all invocations...
Could you be more specific? The compiler invocation in this case is:
```lang=bash
$ext_fc -E "${opts[@]}" "${other_srcs[$idx]}" ${output_definition:+$output_definition}
```
and the diagnostic is:
```lang=bash
flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@"
```
So, `flang-new` should be replaced with `$ext_fc`. Also, `"$@"` should be removed. Anything else? What about other places?

I'm just trying to understand the behavior "before" and "after" this change. Documenting this would be much appreciated (either as a comment here or in the summary). It would really help anyone browsing through the history of this script (in case something breaks, which usually happens to downstream users).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118618



More information about the llvm-commits mailing list