From cad2affb789201f0d7ccb4b5542f652b37c51c3a Mon Sep 17 00:00:00 2001 From: Andrzej Warzynski Date: Wed, 21 Jul 2021 09:53:01 +0100 Subject: [PATCH] [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 --- flang/tools/f18/flang.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flang/tools/f18/flang.in b/flang/tools/f18/flang.in index eb953c58d91a..b2ec2b5709c5 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)