[llvm] [flang-rt] Fix REAL(10)/COMPLEX(10) component sizes in runtime type info (PR #192049)
Sairudra More via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 04:58:34 PDT 2026
================
@@ -280,3 +280,37 @@ 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);
+#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
+ defined(_M_IX86)
+ EXPECT_EQ(Descriptor::BytesFor(TC::Real, 10),
+ 16u); // x87: 80-bit in 128-bit container
----------------
Saieiei wrote:
Done!
https://github.com/llvm/llvm-project/pull/192049
More information about the llvm-commits
mailing list