https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116530
--- Comment #7 from anlauf at gcc dot gnu.org --- (In reply to kargls from comment #5) > (In reply to anlauf from comment #4) > > (In reply to kargls from comment #1) > > > (In reply to philippe.wautelet from comment #0) > > > > > > > > > > > I'm not sure it is conforming to the Fortran standard but it shouldn't > > > > trigger an ICE. > > > > > > > > > > I agree with you about the ICE should not happen. Staring at F2023, > > > I find the following constraint. > > > > > > C8107 (R871) The namelist-group-name shall not be a name accessed by use > > > association. > > > > > > If I understand it, your code is nonstandard. But, I don't use namelist, > > > so > > > will need to read through the Fortran standard a bit more. > > > > This constraint applies to the namelist statement and does not apply to the > > issue here. > > Yeah, I needed to review more the Fortran, and you beat me > to working out a patch. The '(R871)' above restricts the > constraint to namelist statement. However, this did lead to > > module mod_nml1 > implicit none > logical :: ldiag > namelist /nam_nml1/ldiag > end module mod_nml1 > > program ice_nml > use mod_nml1 > implicit none > integer :: ilu, j > namelist /nam_nml1/j !<-- Does this violates C8107? Yes, that is illegal and rejected by Intel and NAG, e.g.: NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7200 Error: iii.f90, line 11: Redeclaration of symbol NAM_NML1 from USEd module MOD_NML1 detected at /@NAM_NML1 Warning: iii.f90, line 15: Unused local variable ILU [NAG Fortran Compiler pass 1 error termination, 1 error, 1 warning] I think we should track that constraint violation separately (no regression) from the present PR (regression). > ldiag = .false. > j = 42 > write(*,nml=nam_nml1) > end program ice_nml > > % gfcx -o z a.f90 && ./z > &NAM_NML1 > LDIAG=F, > J=42 , > /