[llvm] [flang][runtime] fix intrinsics case of extends_type_of (PR #161466)

Peter Klausler via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 09:07:18 PDT 2025


================
@@ -118,29 +118,43 @@ bool RTDEF(SameTypeAs)(const Descriptor &a, const Descriptor &b) {
 }
 
 bool RTDEF(ExtendsTypeOf)(const Descriptor &a, const Descriptor &mold) {
+  // The wording of the standard indicates the order in which each case
+  // is checked. If performance becomes an issue, there are less maintainable
+  // versions of this code that would probably execute faster.
+  // F'23 16.9.86 p 5
+  // If MOLD is unlimited polymorphic and is either a disassociated pointer or
+  // unallocated allocatable variable, the result is true;
----------------
klausler wrote:

```
if (!mold.IsAllocated()) {
  return true;
} else if (!a.IsAllocated()) {
  return false;
}
```

https://github.com/llvm/llvm-project/pull/161466


More information about the llvm-commits mailing list