godotengine / godotengine/godot

GDScript debugger shows incorrect values for very large positive and negative integers

Open
#94,686 3 comments 0 reactions 0 assignees View on GitHub
bug topic:editor topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproduceable: v4.2.2.stable.official [15073afe3]

### System information

Godot v4.2.2.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated AMD Radeon RX 6900 XT (Advanced Micro Devices, Inc.; 32.0.11021.1011) - 12th Gen Intel(R) Core(TM) i7-12700K (20 Threads)

### Issue description

When displaying the values of integers, the GDScript debugger will show incorrect values when the integer is greater than `9223372036854775800` or less than `-9223372036854775800`. Indeed, the debugger will simply limit itself to those two values when the threshold is exceeded.

Integers in GDScript are documented to support values between `-9223372036854775808` and `9223372036854775807`. The behavior of GDScript itself appears to be correct, as printing integers containing those maximum and minimum values produces the correct output.

### Steps to reproduce

In the following function, insert a breakpoint before the first `print()` statement. Run the script in debug mode, and examine the values of `very_large` and `very_negative` in the debugger. Compare what's displayed in the debugger to the output produced by the `print()` statements.

```gdscript
func _ready():
var very_large = 9223372036854775807
var very_negative = -9223372036854775808
print(very_large)
print(very_negative)
```

### Minimal reproduction project (MRP)

[large-int-repro.zip](https://github.com/user-attachments/files/16358338/large-int-repro.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached minimal reproduction project and run the GDScript function with a breakpoint before the print statements. Compare the debugger values for very_large and very_negative with the printed output, then trace the debugger's integer display path. Done means the debugger displays the documented 64-bit boundary values without clamping them.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.