[clang] [flang] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it (PR #91611)
https://github.com/pawosm-arm closed https://github.com/llvm/llvm-project/pull/91611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it (PR #91611)
pawosm-arm wrote: The problem with `-fallow-argument-mismatch` has already been reported to the MPICH project maintainers, https://github.com/pmodels/mpich/issues/6869 therefore I'm going to close this PR. https://github.com/llvm/llvm-project/pull/91611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it (PR #91611)
pawosm-arm wrote: > > It sounds like an issue with the `mpich` build script rather than LLVM Flang. > Why would `mpich` and other projects use this flag to begin with? Do other > Fortran compilers support it? > I don't know why they do that, I suppose they think they know better. I don't suspect they are aware of the pain they brought to the users (of various Fortran compilers). > From GFrotran docs > (https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html): > > > Using this option is strongly discouraged. > As I said, I suppose they think they know better. > In general, I'm hesitant to allow such dummy flags that: > > * do nothing, > * are there merely to prevent issues in build scripts. > > Are there no other ways around it? We obviously should make it possible for > LLVM Flang to build all projects, but I really want to avoid Flang containing > multiple dummy flags only to work around build scripts that assume a > particular compiler is used. > The alternative is to instruct the users how to patch the `configure` scripts. There is always a trade-off between disgust (caused by introduction of ugly flags) and battered user experience (caused by the compiler rejecting a flag that someone in some widely used project insisted that should be accepted). We could document the problem and describe how to work around it, however we must carefully consider the maintenance cost of this extra bit of documentation. > We might be missing some "gfortran compatibility mode" in Flang (on top of > `FlangMode`). Such mode could allow unsupported GFortran flags and warn > whenever those are used. `flang-new` would still "default" to `FlangMode` and > just generate an error. > Yes, we agreed long time ago that gfortran isn't the gold standard of how the Fortran compiler should behave. But the reality always knows it better. And things like mpich or netcdf are widely used in the exact environment we want to target with our compiler. https://github.com/llvm/llvm-project/pull/91611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it (PR #91611)
banach-space wrote: Thank you for this contribution Paul! > Many autotools-utilizing projects (mpich among them) fail to complete the > configure step since it tries to invoke the (unknown to them) Fortran > compiler always with the -fallow-argument-mismatch flag. It sounds like an issue with the `mpich` build script rather than LLVM Flang. Why would `mpich` and other projects use this flag to begin with? Do other Fortran compilers support it? From GFrotran docs (https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html): > Using this option is strongly discouraged. In general, I'm hesitant to allow such dummy flags that: * do nothing, * are there merely to prevent issues in build scripts. Are there no other ways around it? We obviously should make it possible for LLVM Flang to build all projects, but I really want to avoid Flang containing multiple dummy flags only to work around build scripts that assume a particular compiler is used. We might be missing some "gfortran compatibility mode" in Flang (on top of `FlangMode`). Such mode could allow unsupported GFortran flags and warn whenever those are used. `flang-new` would still "default" to `FlangMode` and just generate an error. In any case, it would be good to get more opinions on this. @kiranchandramohan , anyone else might be interested in this? https://github.com/llvm/llvm-project/pull/91611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it (PR #91611)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Paul Osmialowski (pawosm-arm) Changes Many autotools-utilizing projects (mpich among them) fail to complete the `configure` step since it tries to invoke the (unknown to them) Fortran compiler always with the `-fallow-argument-mismatch` flag. As the use of this flag has no impact on flang, there is no definite need to reject it. It would be better to accept it with a warning and reject the opposite flag `-fno-allow-argument-mismatch` with an error. With this patch, mpich compiles and works. --- Full diff: https://github.com/llvm/llvm-project/pull/91611.diff 2 Files Affected: - (modified) clang/include/clang/Driver/Options.td (+2) - (added) flang/test/Driver/allow-argument-mismatch.f90 (+15) ``diff diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 73a2518480e9b..eaa17fdec0f8b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2540,6 +2540,8 @@ def fsanitize_undefined_strip_path_components_EQ : Joined<["-"], "fsanitize-unde } // end -f[no-]sanitize* flags +def fallow_argument_mismatch : Flag<["-"], "fallow-argument-mismatch">, Visibility<[FlangOption, FC1Option]>; + def funsafe_math_optimizations : Flag<["-"], "funsafe-math-optimizations">, Group, Visibility<[ClangOption, CC1Option]>, HelpText<"Allow unsafe floating-point math optimizations which may decrease precision">, diff --git a/flang/test/Driver/allow-argument-mismatch.f90 b/flang/test/Driver/allow-argument-mismatch.f90 new file mode 100644 index 0..2adf9e67daeab --- /dev/null +++ b/flang/test/Driver/allow-argument-mismatch.f90 @@ -0,0 +1,15 @@ +! Test that -fallow-argument-mismatch flag is accepted with warning, while +! -fno-allow-argument-mismatch is rejected with error + +! RUN: %flang -S %s -fallow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING +! RUN: %flang_fc1 -S %s -fallow-argument-mismatch -o /dev/null +! RUN: not %flang -S %s -fno-allow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR +! RUN: not %flang_fc1 -S %s -fno-allow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR + +! CHECK-WARNING: warning: +! CHECK_WARNING-SAME: argument unused +! CHECK_WARNING-SAME: -fallow-argument-mismatch + +! CHECK-ERROR: error: +! CHECK-ERROR-SAME: unknown argument +! CHECK-ERROR-SAME: -fno-allow-argument-mismatch `` https://github.com/llvm/llvm-project/pull/91611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it (PR #91611)
llvmbot wrote: @llvm/pr-subscribers-flang-driver Author: Paul Osmialowski (pawosm-arm) Changes Many autotools-utilizing projects (mpich among them) fail to complete the `configure` step since it tries to invoke the (unknown to them) Fortran compiler always with the `-fallow-argument-mismatch` flag. As the use of this flag has no impact on flang, there is no definite need to reject it. It would be better to accept it with a warning and reject the opposite flag `-fno-allow-argument-mismatch` with an error. With this patch, mpich compiles and works. --- Full diff: https://github.com/llvm/llvm-project/pull/91611.diff 2 Files Affected: - (modified) clang/include/clang/Driver/Options.td (+2) - (added) flang/test/Driver/allow-argument-mismatch.f90 (+15) ``diff diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 73a2518480e9b..eaa17fdec0f8b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2540,6 +2540,8 @@ def fsanitize_undefined_strip_path_components_EQ : Joined<["-"], "fsanitize-unde } // end -f[no-]sanitize* flags +def fallow_argument_mismatch : Flag<["-"], "fallow-argument-mismatch">, Visibility<[FlangOption, FC1Option]>; + def funsafe_math_optimizations : Flag<["-"], "funsafe-math-optimizations">, Group, Visibility<[ClangOption, CC1Option]>, HelpText<"Allow unsafe floating-point math optimizations which may decrease precision">, diff --git a/flang/test/Driver/allow-argument-mismatch.f90 b/flang/test/Driver/allow-argument-mismatch.f90 new file mode 100644 index 0..2adf9e67daeab --- /dev/null +++ b/flang/test/Driver/allow-argument-mismatch.f90 @@ -0,0 +1,15 @@ +! Test that -fallow-argument-mismatch flag is accepted with warning, while +! -fno-allow-argument-mismatch is rejected with error + +! RUN: %flang -S %s -fallow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING +! RUN: %flang_fc1 -S %s -fallow-argument-mismatch -o /dev/null +! RUN: not %flang -S %s -fno-allow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR +! RUN: not %flang_fc1 -S %s -fno-allow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR + +! CHECK-WARNING: warning: +! CHECK_WARNING-SAME: argument unused +! CHECK_WARNING-SAME: -fallow-argument-mismatch + +! CHECK-ERROR: error: +! CHECK-ERROR-SAME: unknown argument +! CHECK-ERROR-SAME: -fno-allow-argument-mismatch `` https://github.com/llvm/llvm-project/pull/91611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it (PR #91611)
https://github.com/pawosm-arm created https://github.com/llvm/llvm-project/pull/91611 Many autotools-utilizing projects (mpich among them) fail to complete the `configure` step since it tries to invoke the (unknown to them) Fortran compiler always with the `-fallow-argument-mismatch` flag. As the use of this flag has no impact on flang, there is no definite need to reject it. It would be better to accept it with a warning and reject the opposite flag `-fno-allow-argument-mismatch` with an error. With this patch, mpich compiles and works. >From afeb4498c0f5b9f4e41e486b28caa0603740ae2c Mon Sep 17 00:00:00 2001 From: Paul Osmialowski Date: Thu, 9 May 2024 16:23:38 +0100 Subject: [PATCH] [flang][driver] Accept -fallow-argument-mismatch with a warning instead of rejecting it Many autotools-utilizing projects (mpich among them) fail to complete the `configure` step since it tries to invoke the (unknown to them) Fortran compiler always with the `-fallow-argument-mismatch` flag. As the use of this flag has no impact on flang, there is no definite need to reject it. It would be better to accept it with a warning and reject the opposite flag `-fno-allow-argument-mismatch` with an error. --- clang/include/clang/Driver/Options.td | 2 ++ flang/test/Driver/allow-argument-mismatch.f90 | 15 +++ 2 files changed, 17 insertions(+) create mode 100644 flang/test/Driver/allow-argument-mismatch.f90 diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 73a2518480e9b..eaa17fdec0f8b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2540,6 +2540,8 @@ def fsanitize_undefined_strip_path_components_EQ : Joined<["-"], "fsanitize-unde } // end -f[no-]sanitize* flags +def fallow_argument_mismatch : Flag<["-"], "fallow-argument-mismatch">, Visibility<[FlangOption, FC1Option]>; + def funsafe_math_optimizations : Flag<["-"], "funsafe-math-optimizations">, Group, Visibility<[ClangOption, CC1Option]>, HelpText<"Allow unsafe floating-point math optimizations which may decrease precision">, diff --git a/flang/test/Driver/allow-argument-mismatch.f90 b/flang/test/Driver/allow-argument-mismatch.f90 new file mode 100644 index 0..2adf9e67daeab --- /dev/null +++ b/flang/test/Driver/allow-argument-mismatch.f90 @@ -0,0 +1,15 @@ +! Test that -fallow-argument-mismatch flag is accepted with warning, while +! -fno-allow-argument-mismatch is rejected with error + +! RUN: %flang -S %s -fallow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING +! RUN: %flang_fc1 -S %s -fallow-argument-mismatch -o /dev/null +! RUN: not %flang -S %s -fno-allow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR +! RUN: not %flang_fc1 -S %s -fno-allow-argument-mismatch -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR + +! CHECK-WARNING: warning: +! CHECK_WARNING-SAME: argument unused +! CHECK_WARNING-SAME: -fallow-argument-mismatch + +! CHECK-ERROR: error: +! CHECK-ERROR-SAME: unknown argument +! CHECK-ERROR-SAME: -fno-allow-argument-mismatch ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits