<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/106928>106928</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Compilation error when type name and a variable name defined in component-def-statement are the same name in parent type for extended type
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
Version of flang-new : 20.0.0(675c748bb606d75a959481e6014299849cf3094c)/AArch64
```

When `type name` and a variable name defined in `component-def-statement` are the same name in `parent type` for `extended type`, a compilation-time error occurs.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

snggr712_12.f90:
```fortran
program main
  type x
 integer,allocatable::x
  end type x
  type,extends(x)::x1
 integer,allocatable::y
  end type x1
  type(x1) ::p1=x1(null(),null())
  type(x1)          ::v1
  print *,'pass'
end program main
```

```
$ flang-new snggr712_12.f90
error: Semantic errors in snggr712_12.f90
./snggr712_12.f90:5:16: error: Type cannot be extended as it has a component named 'x'
 type,extends(x)::x1
                 ^
./snggr712_12.f90:3:27: Previous declaration of 'x'
       integer,allocatable::x
 ^
./snggr712_12.f90:8:36: error: Unexpected value in structure constructor
    type(x1)          ::p1=x1(null(),null())
 ^^^^^^
$
```

```
$ gfortran snggr712_12.f90; ./a.out
 pass
$
```

```
$ ifort -diag-disable=10448 snggr712_12.f90
snggr712_12.f90(5): error #8205: A component declared in an extended type cannot have the same name as any accessible compone
nt of its parent type.   [X]
 type,extends(x)::x1
---------------^
compilation aborted for snggr712_12.f90 (code 1)
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVk1z4jgT_jXi0gUltz-wDxwYeHmvW7WzH7ctIbWNpoxESTIh_35LlmGAZCaZdbmSqKN-uvX0o24L73VniFas_MLK7UwM4WDdyh6MnbffZ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