*pointerSymbol);
} else {
// object pointer and target
+ if (const Symbol * targetSymbol{GetLastSymbol(*targetExpr)}) {
+ if (!(targetSymbol->attrs().test(semantics::Attr::POINTER) ||
+ targetSymbol->attrs().test(
+ semantics::Attr::TARGET))) {
+ AttachDeclaration(
+ messages.Say("TARGET= argument '%s' must have either "
+ "the POINTER or the TARGET "
+ "attribute"_err_en_US,
+ targetName),
+ *targetSymbol);
+ }
+ }
+
if (const auto pointerType{pointerArg->GetType()}) {
if (const auto targetType{targetArg->GetType()}) {
ok = pointerType->IsTkCompatibleWith(*targetType);
lVar = associated(intVar, intVar)
!ERROR: POINTER= argument of ASSOCIATED() must be a POINTER
lVar = associated(intAllocVar)
- lVar = associated(intPointerVar1, intVar) !OK
!ERROR: Arguments of ASSOCIATED() must be a POINTER and an optional valid target
lVar = associated(intPointerVar1, targetRealVar)
lVar = associated(intPointerVar1, targetIntVar1) !OK
lVar = associated(intPointerVar1, targetIntVar2)
lVar = associated(intPointerVar1) !OK
lVar = associated(intPointerVar1, intPointerVar2) !OK
+ !ERROR: In assignment to object pointer 'intpointervar1', the target 'intvar' is not an object with POINTER or TARGET attributes
+ intPointerVar1 => intVar
+ !ERROR: TARGET= argument 'intvar' must have either the POINTER or the TARGET attribute
+ lVar = associated(intPointerVar1, intVar)
! Procedure pointer tests
intprocPointer1 => intProc !OK