| Issue |
182527
|
| Summary |
[Flang]: Driver suggests a chain of invalid workarounds ('-Xclang' then '-Xflang') for unsupported flags
|
| Labels |
flang
|
| Assignees |
|
| Reporter |
Acture
|
# Steps to Reproduce
Passing a standard LLVM hardening flag to flang triggers a chain of invalid typo-correction suggestions:
1. The driver rejects the flag and suggests -Xclang:
```Bash
$ nix-shell -p llvmPackages_21.flang --run "flang -fstack-clash-protection hello.f90"
flang-21: error: unknown argument '-fstack-clash-protection'; did you mean '-Xclang -fstack-clash-protection'?
2. Following the suggestion results in conflicting typo-corrections:
```
```Bash
$ nix-shell -p llvmPackages_21.flang --run "flang -Xclang -fstack-clash-protection hello.f90"
flang-21: error: unknown argument '-Xclang'; did you mean '-Xflang'?
flang-21: error: unknown argument '-fstack-clash-protection'; did you mean '-Xclang -fstack-clash-protection'?
```
3. Following the new suggestion (-Xflang) hits a hard frontend error:
```Bash
$ nix-shell -p llvmPackages_21.flang --run "flang -Xflang -fstack-clash-protection hello.f90"
error: unknown argument: '-fstack-clash-protection'
```
(Note: Similar invalid -Xclang suggestions occur with C-centric flags like -isystem or -fmacro-prefix-map when injected by global build environments).
# Expected Behavior
- The driver should not suggest -Xclang when invoked as flang or flang-new. If an escape-hatch suggestion is absolutely necessary, it should directly be -Xflang.
- For genuine LLVM codegen flags (like -fstack-clash-protection) that lack corresponding wiring in the fc1 frontend, the driver should reject them outright with a definitive error (e.g., error: unsupported by the Flang frontend), rather than initiating an invalid typo-correction chain.
- For standard C-centric flags injected by global build hooks (e.g., -isystem, -fmacro-prefix-map), flang should ideally emit a suppressible warning instead of a hard error, enabling drop-in compatibility.
# Environment
OS: Linux (NixOS) / macOS
LLVM/Flang version: 21.0.0 (main)
Related to #139220
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs