You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test "dump for basic_json with long double number_float_t" fails when run with Valgrind #5175
We recently added a test for long double (see #3929). This test fails when run with Valgrind.
Reproduction steps
Run test ci_test_valgrind.
Expected vs. actual results
Actual:
==4504== Memcheck, a memory error detector
==4504== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==4504== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==4504== Command: /home/runner/work/json/json/build/build_valgrind/tests/test-serialization_cpp11
==4504==
[doctest] doctest version is "2.4.12"
[doctest] run with "--help" for options
===============================================================================
/home/runner/work/json/json/tests/src/unit-serialization.cpp:300:
TEST CASE: dump for basic_json with long double number_float_t
NaN and infinity dump as null
/home/runner/work/json/json/tests/src/unit-serialization.cpp:347: ERROR: CHECK( long_double_json(std::numeric_limits<long double>::infinity()).dump() == "null" ) is NOT correct!
values: CHECK( 1.18973149535723176509e+4932 == null )
/home/runner/work/json/json/tests/src/unit-serialization.cpp:348: ERROR: CHECK( long_double_json(-std::numeric_limits<long double>::infinity()).dump() == "null" ) is NOT correct!
values: CHECK( -1.18973149535723176509e+4932 == null )
===============================================================================
[doctest] test cases: 7 | 6 passed | 1 failed | 0 skipped
[doctest] assertions: 107 | 105 passed | 2 failed |
[doctest] Status: FAILURE!
==4504==
==4504== HEAP SUMMARY:
==4504== in use at exit: 0 bytes in 0 blocks
==4504== total heap usage: 892 allocs, 892 frees, 227,982 bytes allocated
==4504==
==4504== All heap blocks were freed -- no leaks are possible
==4504==
==4504== For lists of detected and suppressed errors, rerun with: -s
==4504== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Minimal code example
N/A
Error messages
See above.
Compiler and operating system
g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Library version
develop
Validation
The bug also occurs if the latest version from the develop branch is used.
Activity
nlohmann commentedon May 16, 2026
FYI @RUSLoker
RUSLoker commentedon May 16, 2026
Took it on.
nlohmann commentedon May 16, 2026
It may just be a Valgrind quirk.
milestone-17 commentedon May 16, 2026
I'm interested in working on this issue. I've read through the description and understand what needs to be done.
Could you please assign this issue to me? I'll submit a PR within [X days/weeks].
Thanks!
nlohmann commentedon May 16, 2026
The ticket is already assigned and a PR is created.
milestone-17 commentedon May 16, 2026
Thanks,Is my error
Fix `long double` inf test under Valgrind. Fixes nlohmann#5175 (nlohm…
Fix `long double` inf test under Valgrind. Fixes nlohmann#5175 (nlohm…
Fix `long double` inf test under Valgrind. Fixes nlohmann#5175 (nlohm…