Skip to content

[tests] Use size_t in variable reflection offset tests#622

Merged
aaronj0 merged 1 commit intocompiler-research:mainfrom
aaronj0:32b-offsets
Jun 10, 2025
Merged

[tests] Use size_t in variable reflection offset tests#622
aaronj0 merged 1 commit intocompiler-research:mainfrom
aaronj0:32b-offsets

Conversation

@aaronj0
Copy link
Copy Markdown
Collaborator

@aaronj0 aaronj0 commented Jun 10, 2025

This fixes failures on big endian systems (s390x). Upstream of root-project/root#18992

This fixes failures on 32 bit platforms. Upstream of root-project/root#18992
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions


intptr_t offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(3, *(int*)offset);
EXPECT_EQ(3, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  EXPECT_EQ(3, *(size_t*)offset);
                ^


intptr_t offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(3, *(int*)offset);
EXPECT_EQ(3, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

  EXPECT_EQ(3, *(size_t*)offset);
                ^


offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(5, *(int*)offset);
EXPECT_EQ(5, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  EXPECT_EQ(5, *(size_t*)offset);
                ^


offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(5, *(int*)offset);
EXPECT_EQ(5, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

  EXPECT_EQ(5, *(size_t*)offset);
                ^


offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(2, *(int*)offset);
EXPECT_EQ(2, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]

  EXPECT_EQ(2, *(size_t*)offset);
                ^


offset = Cpp::GetVariableOffset(datamembers[0]);
EXPECT_EQ(2, *(int*)offset);
EXPECT_EQ(2, *(size_t*)offset);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: integer to pointer cast pessimizes optimization opportunities [performance-no-int-to-ptr]

  EXPECT_EQ(2, *(size_t*)offset);
                ^

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.66%. Comparing base (730abc7) to head (dd90a81).
⚠️ Report is 70 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #622   +/-   ##
=======================================
  Coverage   77.66%   77.66%           
=======================================
  Files           9        9           
  Lines        3743     3743           
=======================================
  Hits         2907     2907           
  Misses        836      836           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aaronj0 aaronj0 merged commit 3f0bfc4 into compiler-research:main Jun 10, 2025
50 checks passed
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.

2 participants