LLVM Flang does not properly handle `fortran_std`
- Dominant language
- Python
- Stars
- 6.6k
- Forks
- 1.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 33
Description
**Describe the bug**
When using llvm-flang, no value of `fortran_std` is accepted except `none`, even though the compiler supports `f2018`. (There is a separate issue on whether or not it should error out at all discussed in #11633)
**To Reproduce**
```
project('bad_std', 'fortran',
default_options: ['fortran_std=f2018']
)
fc = meson.get_compiler('fortran')
message('compiler is @0@'.format(fc.get_id()))
```
The result with `FC=flang meson setup build` is:
```
meson.build:1:0: ERROR: Value "f2018" (of type "string") for option "fortran_fortran_std" is not one of the choices. Possible choices are (as string): "none".
```
**Expected behavior**
This should succeed, since the following does:
```
./build/bin/flang -std=f2018 hello.f90 # some trivial hello world fortran program
echo $?
0
```
```
./build/bin/flang --version
flang version 21.1.7
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/laser/git/llvm-flang/build/bin
```
**system parameters**
* Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)? native
* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Linux
* what Python version are you using e.g. 3.8.0 3.13.0
* what `meson --version` 1.10.0
* what `ninja --version` if it's a Ninja build 1.13.2
Contributor guide
Research direction
Reproduce the issue with the provided meson.build example using FC=flang meson setup build, then inspect how Meson handles the fortran_std option for Flang. Compare the accepted values with flang -std=f2018; done means a native setup accepts fortran_std=f2018 without the reported choices error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100