https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104776

            Bug ID: 104776
           Summary: incorrect compiler error with Parameterized derived
                    type component initialization
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: a.shahmoradi at gmail dot com
  Target Milestone: ---

The following code is standard-conforming, but none of the gfortran latest
versions can compile it,

```
module pdt_mod

    use iso_fortran_env

    type                    :: BG_type(kind)
        integer     , kind  :: kind = character_kinds(1)
        character(5 , kind) :: str = achar(27,kind)
    end type

end module

end
```

An example error message is the following,

```
    7 |         character(5 , kind) :: str = achar(27,kind)
      |                                    1
Error: Cannot convert UNKNOWN to CHARACTER(5) at (1)
```

Intel ifort does not have any problems compiling this code. The code can be
tested here: https://godbolt.org/z/x56MqPqbM

Reply via email to