Failure building fortran-sdl2 binding interfaces
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
`flang` fails to build [fortran-sdl2](https://github.com/interkosmos/fortran-sdl2). For example, as STC
```
$ flang `sdl2-config --cflags` -O3 -fPIC -c src/c_util.f90
error: Semantic errors in src/c_util.f90
./src/c_util.f90:12:27: error: PARAMETER attribute was already specified on 'c_uint8_t'
integer, parameter :: c_uint8_t = c_int8_t
^^^^^^^^^
./src/c_util.f90:12:27: error: 'c_uint8_t' is use-associated from module 'iso_c_binding' and cannot be re-declared
integer, parameter :: c_uint8_t = c_int8_t
^^^^^^^^^
[...]
```
The same command works with `gfortran`, indeed I use it for my programs!
I tested this in MSYS2/UCRT64 with
```
$ flang --version
flang version 21.1.1
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/ucrt64/bin
```
Contributor guide
Research direction
Reproduce the failure with flang 21.1.1 using the shown sdl2-config command, then inspect src/c_util.f90 around line 12 and the handling of iso_c_binding declarations. Compare the diagnostic with gfortran's behavior. Done means the fortran-sdl2 binding interfaces build successfully with flang without the redeclaration errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100