[PATCH] D84290: [Flang] Fix for the scenario when type guard has intrinsic type specification and Selector is NOT unlimited Polymorphic.

Inderjeet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 17:21:29 PDT 2020


inderjeet-hcl marked an inline comment as done.
inderjeet-hcl added a comment.

Kindly check comments inline and suggest.



================
Comment at: flang/lib/Semantics/check-select-type.cpp:103
+              } else {
+                const DerivedTypeSpec *derived{spec->AsDerived()};
+                typeSpecRetVal = PassesDerivedTypeChecks(
----------------
sameeranjoshi wrote:
> `DeclTypeSpec::AsDerived` might return `nullptr`. Please wrap it in some conditional statement.
I have added  CHECK(spec); and CHECK(spec->AsIntrinsic() || spec->AsDerived()); at the start considering if code in block "[&](const parser::TypeSpec &typeSpec)" is executed then spec will always be one of intrinsic or derived type and one of AsIntrinsic() or AsDerived() will return non NULL value.
Considering above description, I think AsDerived() will not return NULL at this location as this code is present in 'else' of AsIntrinsic().
Kindly suggest.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84290/new/

https://reviews.llvm.org/D84290





More information about the llvm-commits mailing list