llvm / llvm/llvm-project

[flang] Missing diagnostic for duplicate type parameter identifiers

Open
#219,240 1 comment 0 reactions 0 assignees View on GitHub
flang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Consider the following code

```fortran
module m
type base (k)
integer, kind :: k = 4
end type

type, extends(base) :: child (k) !<-- illegal
integer, len :: k = 10
end type
end module
```

It is illegal to declare a type parameter with the same name as the other type parameter in its parent type.

Flang compiles the code successfully.
All ifx, gfortran and XLF issue an error message.

Contributor guide

Open the contributing guide

Research direction

Start by running Flang on the Fortran reproducer in this issue and trace the semantic handling of derived-type parameters and inheritance. Done means Flang rejects the duplicate `k` parameter in `child` with a diagnostic, consistent with the other compilers mentioned.

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
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.