[flang-dev] [RFC] Frontend driver: action vs non-action options

Andrzej Warzynski via flang-dev flang-dev at lists.llvm.org
Thu Nov 4 01:55:21 PDT 2021

Let me just quickly summarise.

The behaviour of `flang-new -fc1` is consistent with `clang -cc1`, but 
slightly different to Gfortran (in particular, with respect to the 
`-fdump-parse-tree`). Also, the current implementation works as 
expected, i.e. there are no known bugs that would require immediate 

One could (and perhaps should?) refactor the dump options - currently 
there's quite a few of them. There are a few options here - 
`-fdump=unparse,symbols -o dump.txt` looks particularly promising.

I'm not sure whether any of Flang's dump options should be refactored as 
regular flags, but it seems like the most natural way to replicate 
GFortran's behaviour here. I won't block any efforts in this direction, 
but please keep in mind that we will likely need Flang's parse tree for 
future static analysis tools/frameworks (e.g. sanitizers?). This means 
that the parse tree needs to be considered as regular compiler 
input/output (as opposed to a plain debug dump).

Please let me know if you want to work on any of the above - I'll be 
available for your questions and to review your patches. As for making 
`flang-new -fc1` error out when multiple actions are specified, there's 
https://reviews.llvm.org/D111781. I've reached out to cfe-dev to see 
what they think [1], but there seemed to be little appetite for 
discussion. Let me add some reviewers from LLVM instead. Pete has 
already accepted it (thank you!), but since it touches both Flang *and* 
LLVM, I want to make sure that developers from LLVM are also OK with this.

Thank you for all your feedback!


[1] https://lists.llvm.org/pipermail/cfe-dev/2021-October/069132.html

On 19/10/2021 19:31, Andrzej Warzynski via flang-dev wrote:
> We would like Flang's driver to be a drop-in replacement for e.g. 
> `gfortran`. If we change this particular behaviour, we will be making 
> the transition for our users harder.
> -Andrzej

More information about the flang-dev mailing list