[flang-commits] [flang] cad2aff - [flang][driver] Make `flang` ignore `-Mfree/-Mfixed`

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Tue Jul 27 05:13:29 PDT 2021


Author: Andrzej Warzynski
Date: 2021-07-27T13:12:28+01:00
New Revision: cad2affb789201f0d7ccb4b5542f652b37c51c3a

URL: https://github.com/llvm/llvm-project/commit/cad2affb789201f0d7ccb4b5542f652b37c51c3a
DIFF: https://github.com/llvm/llvm-project/commit/cad2affb789201f0d7ccb4b5542f652b37c51c3a.diff

LOG: [flang][driver] Make `flang` ignore `-Mfree/-Mfixed`

`-Mfixed` is not supported by the new driver and hence
`flang`, the bash wrapper script, forwards it to the host compiler.
The forwarded options are used by the host compiler when compiling the
unparsed files. As the unparsed source files are always in the free
form, forwarding `-Mfixed` is problematic.

With this patch, `-Mfixed` (and `-Mfree` for consistency) will be
ignored altogether. The user will only see a warning. This is not a
particularly sound approach, but `flang` is only a temporary solution
for us and this workaround is a fair compromise.

Differential Revision: https://reviews.llvm.org/D106428

Added: 
    

Modified: 
    flang/tools/f18/flang.in

Removed: 
    


################################################################################
diff  --git a/flang/tools/f18/flang.in b/flang/tools/f18/flang.in
index eb953c58d91a9..b2ec2b5709c5f 100755
--- a/flang/tools/f18/flang.in
+++ b/flang/tools/f18/flang.in
@@ -210,6 +210,12 @@ categorise_opts()
       [[ $opt =~ ^-U.* ]] ||
       [[ $opt == "-Werror" ]]; then
       flang_opts+=($opt)
+    elif
+      # These options are not supported by `flang-new`. There is also no point
+      # in forwarding them to the host compiler as the output from
+      # `-fdebug-unparse` will always be in free form.
+      [[ $opt == "-Mfixed" ]] || [[ $opt == "-Mfree" ]]; then
+      :
     elif [[ $opt =~ -I.* ]] || [[ $opt =~ -J.* ]]; then
       # Options that are needed for both Flang and the external driver.
       flang_opts+=($opt)


        


More information about the flang-commits mailing list