Index: flang/lib/Semantics/resolve-names.cpp =================================================================== --- flang/lib/Semantics/resolve-names.cpp +++ flang/lib/Semantics/resolve-names.cpp @@ -3626,8 +3626,7 @@ symbol.ReplaceName(name.source); EndArraySpec(); } else { - Symbol &symbol{DeclareUnknownEntity(name, Attrs{Attr::POINTER})}; - symbol.ReplaceName(name.source); + HandleAttributeStmt(Attr::POINTER, std::get(x.t)); } } Index: flang/test/Semantics/assign02.f90 =================================================================== --- flang/test/Semantics/assign02.f90 +++ flang/test/Semantics/assign02.f90 @@ -15,11 +15,11 @@ subroutine s0 !ERROR: 'p1' may not have both the POINTER and TARGET attributes real, pointer :: p1, p3 + !ERROR: 'p2' may not have both the POINTER and ALLOCATABLE attributes allocatable :: p2 !ERROR: 'sin' may not have both the POINTER and INTRINSIC attributes real, intrinsic, pointer :: sin target :: p1 - !ERROR: 'p2' may not have both the POINTER and ALLOCATABLE attributes pointer :: p2 !ERROR: 'a' may not have the POINTER attribute because it is a coarray real, pointer :: a(:)[*]