diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -3758,8 +3758,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)); } } diff --git a/flang/test/Semantics/assign02.f90 b/flang/test/Semantics/assign02.f90 --- a/flang/test/Semantics/assign02.f90 +++ b/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(:)[*]