Index: flang/lib/Semantics/check-data.cpp =================================================================== --- flang/lib/Semantics/check-data.cpp +++ flang/lib/Semantics/check-data.cpp @@ -70,7 +70,9 @@ : IsHostAssociated(symbol, scope) ? "Host-associated object" : IsUseAssociated(symbol, scope) ? "USE-associated object" : symbol.has() ? "Construct association" - : nullptr}) { + : IsPointer(symbol) && (hasComponent_ || hasSubscript_) + ? "Target of pointer" + : nullptr}) { context_.Say(source_, "%s '%s' must not be initialized in a DATA statement"_err_en_US, whyNot, symbol.name()); Index: flang/test/Semantics/data04.f90 =================================================================== --- flang/test/Semantics/data04.f90 +++ flang/test/Semantics/data04.f90 @@ -65,6 +65,10 @@ type(large) :: largeNumberArray(i) type(large) :: largeArray(5) character :: name(i) + type small + real :: x + end type + type(small), pointer :: sp !C877 !ERROR: Default-initialized 'largenumber' must not be initialized in a DATA statement DATA(largeNumber % numsArray(j) % headOfTheList, j = 1, 10) / 10 * NULL() / @@ -92,6 +96,8 @@ !C876 !ERROR: Automatic variable 'name' must not be initialized in a DATA statement DATA name( : 2) / 'Ancd' / + !ERROR: Target of pointer 'sp' must not be initialized in a DATA statement + DATA sp%x / 1.0 / end end