File tree Expand file tree Collapse file tree 4 files changed +18
-10
lines changed Expand file tree Collapse file tree 4 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -1227,6 +1227,7 @@ bool IsFunctionResult(const Symbol &);
1227
1227
bool IsKindTypeParameter (const Symbol &);
1228
1228
bool IsLenTypeParameter (const Symbol &);
1229
1229
bool IsExtensibleType (const DerivedTypeSpec *);
1230
+ bool IsSequenceOrBindCType (const DerivedTypeSpec *);
1230
1231
bool IsBuiltinDerivedType (const DerivedTypeSpec *derived, const char *name);
1231
1232
bool IsBuiltinCPtr (const Symbol &);
1232
1233
bool IsEventType (const DerivedTypeSpec *);
Original file line number Diff line number Diff line change @@ -1724,9 +1724,13 @@ bool IsLenTypeParameter(const Symbol &symbol) {
1724
1724
}
1725
1725
1726
1726
bool IsExtensibleType (const DerivedTypeSpec *derived) {
1727
- return derived && !IsIsoCType (derived) &&
1728
- !derived->typeSymbol ().attrs ().test (Attr::BIND_C) &&
1729
- !derived->typeSymbol ().get <DerivedTypeDetails>().sequence ();
1727
+ return !IsSequenceOrBindCType (derived) && !IsIsoCType (derived);
1728
+ }
1729
+
1730
+ bool IsSequenceOrBindCType (const DerivedTypeSpec *derived) {
1731
+ return derived &&
1732
+ (derived->typeSymbol ().attrs ().test (Attr::BIND_C) ||
1733
+ derived->typeSymbol ().get <DerivedTypeDetails>().sequence ());
1730
1734
}
1731
1735
1732
1736
bool IsBuiltinDerivedType (const DerivedTypeSpec *derived, const char *name) {
Original file line number Diff line number Diff line change @@ -5940,9 +5940,9 @@ void DeclarationVisitor::Post(const parser::BasedPointer &bp) {
5940
5940
}
5941
5941
if (const auto *pointeeType{pointee->GetType ()}) {
5942
5942
if (const auto *derived{pointeeType->AsDerived ()}) {
5943
- if (!derived-> typeSymbol (). get <DerivedTypeDetails>(). sequence ( )) {
5943
+ if (!IsSequenceOrBindCType (derived )) {
5944
5944
Say (pointeeName,
5945
- " Type of Cray pointee '%s' is a non-sequence derived type" _err_en_US);
5945
+ " Type of Cray pointee '%s' is a derived type that is neither SEQUENCE nor BIND(C) " _err_en_US);
5946
5946
}
5947
5947
}
5948
5948
}
@@ -6177,15 +6177,13 @@ void DeclarationVisitor::CheckCommonBlocks() {
6177
6177
Say (name,
6178
6178
" Unlimited polymorphic pointer '%s' may not appear in a COMMON block" _err_en_US);
6179
6179
} else if (const auto *derived{type->AsDerived ()}) {
6180
- auto &typeSymbol{derived->typeSymbol ()};
6181
- if (!typeSymbol.attrs ().test (Attr::BIND_C) &&
6182
- !typeSymbol.get <DerivedTypeDetails>().sequence ()) {
6180
+ if (!IsSequenceOrBindCType (derived)) {
6183
6181
Say (name,
6184
6182
" Derived type '%s' in COMMON block must have the BIND or"
6185
6183
" SEQUENCE attribute" _err_en_US);
6186
6184
}
6187
6185
UnorderedSymbolSet typeSet;
6188
- CheckCommonBlockDerivedType (name, typeSymbol, typeSet);
6186
+ CheckCommonBlockDerivedType (name, derived-> typeSymbol () , typeSet);
6189
6187
}
6190
6188
}
6191
6189
}
Original file line number Diff line number Diff line change @@ -107,11 +107,16 @@ subroutine p12
107
107
type t2
108
108
integer c2
109
109
end type
110
+ type, bind(c) :: t3
111
+ integer c3
112
+ end type
110
113
type (t1) :: x1
111
114
type (t2) :: x2
115
+ type (t3) :: x3
112
116
pointer (a, x1)
113
- ! ERROR: Type of Cray pointee 'x2' is a non-sequence derived type
117
+ ! ERROR: Type of Cray pointee 'x2' is a derived type that is neither SEQUENCE nor BIND(C)
114
118
pointer (b, x2)
119
+ pointer (c, x3)
115
120
end
116
121
117
122
subroutine p13
You can’t perform that action at this time.
0 commit comments