<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106930>106930</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error when generic-spec is the same name but different access-attr are specified in two generic statements
</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 `generic-spec` is the same name but different `access-attr` are specified in two generic statements, a compilation-time error occurs.
The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.
sngg727n_2.f90:
```fortran
module mod
type :: ty_1
contains
procedure, nopass :: proc_1
generic :: gen_name => proc_1
end type ty_1
type, extends(ty_1) :: ty_2
contains
procedure, nopass :: proc_2
generic, private :: gen_name => proc_2
end type ty_2
type, extends(ty_2) :: ty_3
contains
procedure, nopass :: proc_1
end type ty_3
type(ty_3) :: var
contains
subroutine proc_1()
print *, "Called proc_1"
end subroutine proc_1
subroutine proc_2(dummy_arg)
real, intent(in) :: dummy_arg
write(1,*) dummy_arg
end subroutine proc_2
subroutine w
call var%gen_name(1.0)
end subroutine w
end module mod
program main
use mod
call w
print *,'pass'
end program main
```
```
$ flang-new sngg727n_2.f90
error: Semantic errors in sngg727n_.f90
./sngg727n_.f90:10:27: error: 'gen_name' does not have the same accessibility as its previous declaration
generic,private :: gen_name => proc_2
^^^^^^^^
./sngg727n_.f90:5:27: Previous declaration of 'gen_name'
generic :: gen_name => proc_1
^^^^^^^^
$
```
```
$ gfortran sngg727n_2.f90; ./a.out
pass
$
```
```
$ ifort -diag-disable=10448 sngg727n_2.f90
sngg727n_2.f90(10): error #7553: All type-bound-generic statements for a generic-spec in a derived type must specify the same
accessibility. [GEN_NAME]
generic, private :: gen_name => proc_2
--------------------------^
sngg727n_2.f90(31): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MOD]
use mod
------^
compilation aborted for sngg727n_2.f90 (code 1)
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVt-Po7gP_2vSF6tVMKXAQx-60-nqK31376T79TgKYGj2IKmS0Nn5708BSqHtjFa3V6HMYGL7Y8f52MJaWSmiLYs-sWi_EK07arPVR6WX5bdFpou3Ldvw4eF7xnd_krFSK9AllLVQ1VLRK7BwB8hXfMUZJps4yuN1kmUbviniSKRRuk4C2vBgjWmarNO8DHm6zhmmDA-7ncmPm3Vv_MZXv_51JAVswytSZGS-tCfK2YaDtOCOBFY0BMovWeugkGVJhpTzGiLPydqlcM54BWEIvLIsJRUgFbhXDYNVsE44akg5y_AJBOS6OclaOKnV0smGgIzRBnSet8aupvh-PxKUuq71q1RV58TDcmQdnIyujGi8xcMlWf7lc6mNM0KBUAVI_zL1x_BA3ylv_f9gyLa1mzm0qqpijNULrsqUs3B3k7zBeC9tdNHWBI0u-ncA93Yif2L-0NzbS3CRQ66VE1LZUQA-gJyK1pBHrfRJWHtR9Z8myjBmcvhekXrpjoWFexY-3-wnVfRApgi8wDui745UYRkm3VdMJ3DxZ-DiPVy_82TkWTiCD6HjI-j4IXScQw__k0xP3Ydz90knuvo8C9NvuPVn28zo1klFF-OY-Os4wjkZ6a8Q7jwahvgk6pqKcfMsF_fG3vGCDJOibZq3F2GqmTtDovaepHKkHMNEqkkYV51R4dVI5wMOGD51KNP7XY-w4QNsr1ezuajrLmsYXWrAO_G0lr5jdtD20tur1q8DB0AjpLrYaO3sRnZuRxjT3DOMfSUwjK9u7g0-pM1bIa4nhH1DIb1tT3A-379RI5STeU951jPluP-6fcXwMBeHu8AvGHsjozWG8TWXMRSaLCjt4CjOdCXwnqplJmvp3kBYkM7CydBZ6tZCQXktTE-OfZaut3e8vD90e1n0_Ph5N6ZoDOnXB3B8H5xHOAcI19-P8OLH8Bh-1CcfHHh16TO3LeMT-FDFSrdu8NyV2b_z0jewZS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