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

            Bug ID: 118709
           Summary: Resolution issue: host associated type should conflict
                    with local variable
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

While working on pr108454, I noticed a resolution issue that happens
independently of COMMON:

module m
  implicit none
  type t
  end type
contains
  subroutine s
    type(t) :: x
    real    :: t
  end
end

gfortran compiles this silently, while NAG reports:

Error: newbug.f90, line 8: Invalid redeclaration of host symbol T
       detected at T@<end-of-statement>
Error: newbug.f90, line 8: Data type given to inappropriate symbol T
       detected at T@<end-of-statement>

However, reversing the declarations in subroutine s, I get:

newbug.f90:8:12:

    8 |     type(t) :: x
      |            1
Error: Derived type 't' at (1) is being used before it is defined

Intel:

newbug.f90(8): error #6463: This is not a derived type name.   [T]
    type(t) :: x
---------^

NAG:

Fatal Error: newbug.f90, line 8: T is not a derived type name
             detected at (@T


While the result of resolution may depend on the order because of the conflict,
we should at least see it every time.

Similarly for class(t) instead of type(t).

Reply via email to