[llvm] [flang] Fix REAL(10)/COMPLEX(10) component sizes in runtime type info (PR #192049)

Eugene Epshteyn via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 08:42:52 PDT 2026


================
@@ -280,3 +280,31 @@ TEST(Descriptor, Dump) {
   fclose(tmpf);
 }
 #endif // defined(__linux__) && !defined(__ANDROID__)
+
+// Verify that Descriptor::BytesFor returns the correct storage size
+// for Real and Complex types, especially for kind=10 where the x87
+// 80-bit extended precision value is stored in a 16-byte container.
+TEST(Descriptor, BytesForRealAndComplex) {
+  using TC = TypeCategory;
+  // Real kinds: storage size should account for container padding
+  EXPECT_EQ(Descriptor::BytesFor(TC::Real, 2), 2u);
+  EXPECT_EQ(Descriptor::BytesFor(TC::Real, 3), 2u);
+  EXPECT_EQ(Descriptor::BytesFor(TC::Real, 4), 4u);
+  EXPECT_EQ(Descriptor::BytesFor(TC::Real, 8), 8u);
+  EXPECT_EQ(Descriptor::BytesFor(TC::Real, 10),
----------------
eugeneepshteyn wrote:

(Note that flang-rt buildbots only run in post-commit, so if this test fails on ARM or some other platform, we may not know a few days after PR is submitted.)

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


More information about the llvm-commits mailing list