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

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to John Wingate from comment #2)
> I forgot to mention in the original description that the error does not
> occur if the SELECT CASE is removed.

Right.  The testcase case be slightly reduced to the almost bare minimum:

module m
  implicit none
  private
  public :: select
contains
  subroutine a
    block
      select case (1)
      end select
    end block
  end subroutine a
  !  compiles successfully if name is not 'select'
  subroutine select
  end subroutine select
end module m

Either interchanging the subroutines, commenting "public :: select",
commenting the "select case" block, or commenting "block" while keeping
its contents avoids the error.

Adding -fdump-fortran-original shows why gfortran hits some artifical
conflict:

Namespace: A-Z: (UNKNOWN 0)
procedure name = m
  symtree: 'a'           || symbol: 'a'            
    type spec : (UNKNOWN 0)
    attributes: (PROCEDURE MODULE-PROC  SUBROUTINE IMPLICIT-PURE CONTAINED)
  symtree: 'm'           || symbol: 'm'            
    type spec : (UNKNOWN 0)
    attributes: (MODULE )
  symtree: 'select'      || symbol: 'select'       
    type spec : (UNKNOWN 0)
    attributes: (VARIABLE PUBLIC )

[...]

I have no idea how the above code tricks gfortran into thinking there is
a variable 'select' ...

Reply via email to