diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc index d30a98f48fa..53c54c1c489 100644 --- a/gcc/fortran/match.cc +++ b/gcc/fortran/match.cc @@ -5603,9 +5603,11 @@ gfc_match_namelist (void) return MATCH_ERROR; } + /* A use associated name shall not be used as a namelist group name + (e.g. F2003:C581). It is only supported as a legacy extension. */ if (group_name->attr.flavor == FL_NAMELIST && group_name->attr.use_assoc - && !gfc_notify_std (GFC_STD_GNU, "Namelist group name %qs " + && !gfc_notify_std (GFC_STD_LEGACY, "Namelist group name %qs " "at %C already is USE associated and can" "not be respecified.", group_name->name)) return MATCH_ERROR; diff --git a/gcc/testsuite/gfortran.dg/pr88169_3.f90 b/gcc/testsuite/gfortran.dg/pr88169_3.f90 index 6bc24ed6b71..49ef430e664 100644 --- a/gcc/testsuite/gfortran.dg/pr88169_3.f90 +++ b/gcc/testsuite/gfortran.dg/pr88169_3.f90 @@ -10,6 +10,5 @@ program main use foo_nml, only: bar => foo, x implicit none real a - namelist /bar/a ! { dg-error "already is USE associated" } + namelist /bar/a ! { dg-error "Legacy Extension: .* already is USE associated" } end program -! { dg-final { cleanup-modules "foo_nml" } }