Skip to content

[core] do not assert when casting huge enum uint64_t into int64_t#20925

Merged
dpiparo merged 2 commits into
root-project:masterfrom
ferdymercury:patch-15
Jan 20, 2026
Merged

[core] do not assert when casting huge enum uint64_t into int64_t#20925
dpiparo merged 2 commits into
root-project:masterfrom
ferdymercury:patch-15

Conversation

@ferdymercury
Copy link
Copy Markdown
Collaborator

This Pull request:

Changes or fixes:

even if it becomes negative due to the overflow.

Fixes #17697

Tested that the Python reproducer in #17697 no longer crashes

code = """
struct Foo
{
  enum E {
    BIG = ((unsigned long long)1)<<63
  };
};
"""

import ROOT
ROOT.gInterpreter.Declare (code)

f = ROOT.Foo()
f.BIG
(Foo::E::Foo::E::BIG) : (internal_enum_type_t) -9223372036854775808

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

Copy link
Copy Markdown
Member

@pcanal pcanal left a comment

Choose a reason for hiding this comment

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

I suppose this is an okay solution. It would be even better if we could return the correct value (would likely require more significant changes)

@dpiparo
Copy link
Copy Markdown
Member

dpiparo commented Jan 16, 2026

Do we maybe need a unit test for this?

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 17, 2026

Test Results

    22 files      22 suites   3d 15h 46m 38s ⏱️
 3 812 tests  3 811 ✅ 0 💤 1 ❌
76 720 runs  76 719 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 8da579a.

♻️ This comment has been updated with latest results.

@dpiparo dpiparo assigned pcanal and dpiparo and unassigned pcanal Jan 17, 2026
dpiparo added a commit to ferdymercury/root that referenced this pull request Jan 18, 2026
all the credit goes to ferdymercury.
@dpiparo dpiparo requested a review from bellenot as a code owner January 18, 2026 12:19
dpiparo added a commit to ferdymercury/root that referenced this pull request Jan 18, 2026
@dpiparo
Copy link
Copy Markdown
Member

dpiparo commented Jan 18, 2026

I added a test and restarted the builds. Let's see how builds go and then we can merge.

@ferdymercury
Copy link
Copy Markdown
Collaborator Author

test seems to fail on Windows. Maybe internal_enum_type_t has a different size on Windows?

Comment thread core/metacling/test/MetaClingTests.py Outdated
all the credit goes to @ferdymercury and
@bellenot for crafting the test.
@dpiparo
Copy link
Copy Markdown
Member

dpiparo commented Jan 19, 2026

2 commits were fused to ease future bisects.

@ferdymercury ferdymercury requested a review from bellenot January 20, 2026 08:03
@dpiparo dpiparo merged commit 89f9c42 into root-project:master Jan 20, 2026
48 of 53 checks passed
@ferdymercury ferdymercury deleted the patch-15 branch January 20, 2026 10:28
dpiparo added a commit to dpiparo/root that referenced this pull request Jan 20, 2026
all the credit goes to @ferdymercury and
@bellenot for crafting the test.

(cherry picked from commit 89f9c42)
dpiparo added a commit to dpiparo/root that referenced this pull request Jan 20, 2026
all the credit goes to @ferdymercury and
@bellenot for crafting the test.

(cherry picked from commit 89f9c42)
dpiparo added a commit that referenced this pull request Jan 21, 2026
all the credit goes to @ferdymercury and
@bellenot for crafting the test.

(cherry picked from commit 89f9c42)
dpiparo added a commit that referenced this pull request Jan 21, 2026
all the credit goes to @ferdymercury and
@bellenot for crafting the test.

(cherry picked from commit 89f9c42)
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.

pyroot can trigger clang assertion failure on enum with value too big to fit in int64_t

4 participants