Skip to content

Fix test for 32 bit architectures #18993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ellert
Copy link
Contributor

@ellert ellert commented Jun 7, 2025

The size of the struct isdifferent on 32 bit architectures.

[ RUN      ] TypeReflectionTest.GetSizeOfType
/builddir/build/BUILD/root-6.36.00-build/root-6.36.00/interpreter/CppInterOp/unittests/CppInterOp/TypeReflectionTest.cpp:79: Failure
Expected equality of these values:
  Cpp::GetSizeOfType(Cpp::GetVariableType(Decls[4]))
    Which is: 12
  16
[  FAILED  ] TypeReflectionTest.GetSizeOfType (23 ms)

[ RUN      ] ScopeReflectionTest.SizeOf
/builddir/build/BUILD/root-6.36.00-build/root-6.36.00/interpreter/CppInterOp/unittests/CppInterOp/ScopeReflectionTest.cpp:161: Failure
Expected equality of these values:
  Cpp::SizeOf(Decls[7])
    Which is: 12
  (size_t)16
    Which is: 16
[  FAILED  ] ScopeReflectionTest.SizeOf (26 ms)

[ RUN      ] TypeReflectionTest.GetSizeOfType
/builddir/build/BUILD/root-6.36.00-build/root-6.36.00/interpreter/CppInterOp/unittests/CppInterOp/TypeReflectionTest.cpp:79: Failure
Expected equality of these values:
  Cpp::GetSizeOfType(Cpp::GetVariableType(Decls[4]))
    Which is: 12
  16
[  FAILED  ] TypeReflectionTest.GetSizeOfType (23 ms)

[ RUN      ] ScopeReflectionTest.SizeOf
/builddir/build/BUILD/root-6.36.00-build/root-6.36.00/interpreter/CppInterOp/unittests/CppInterOp/ScopeReflectionTest.cpp:161: Failure
Expected equality of these values:
  Cpp::SizeOf(Decls[7])
    Which is: 12
  (size_t)16
    Which is: 16
[  FAILED  ] ScopeReflectionTest.SizeOf (26 ms)
@ellert ellert requested a review from dpiparo as a code owner June 7, 2025 18:27
@guitargeek guitargeek requested review from aaronj0 and removed request for dpiparo June 7, 2025 19:13
@guitargeek
Copy link
Contributor

guitargeek commented Jun 7, 2025

This needs to be reviewed by @Vipul-Cariappa or @aaronj0. Maybe the same change should be applied upstream?

Copy link

github-actions bot commented Jun 7, 2025

Test Results

    19 files      19 suites   3d 8h 2m 58s ⏱️
 2 805 tests  2 804 ✅ 0 💤 1 ❌
51 795 runs  51 794 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 9efe32d.

@@ -158,7 +158,7 @@ TEST(ScopeReflectionTest, SizeOf) {
EXPECT_EQ(Cpp::SizeOf(Decls[4]), (size_t)0);
EXPECT_EQ(Cpp::SizeOf(Decls[5]), (size_t)1);
EXPECT_EQ(Cpp::SizeOf(Decls[6]), (size_t)4);
EXPECT_EQ(Cpp::SizeOf(Decls[7]), (size_t)16);
EXPECT_EQ(Cpp::SizeOf(Decls[7]), (size_t) (sizeof(size_t) == 4 ? 12 : 16));
Copy link
Contributor

@aaronj0 aaronj0 Jun 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the CI failure, I believe we also need to account for 32-bit MSVC platforms since the double is 8-byte aligned.

Perhaps an approach like:

Suggested change
EXPECT_EQ(Cpp::SizeOf(Decls[7]), (size_t) (sizeof(size_t) == 4 ? 12 : 16));
struct B {short a; double b;};
EXPECT_EQ(Cpp::SizeOf(Decls[7]), sizeof(B));

should always reflect the correct platform ABI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants