Skip to content

Test "dump for basic_json with long double number_float_t" fails when run with Valgrind #5175

Closed

Description

@nlohmann

Description

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

Activity

  1. nlohmann commented on May 16, 2026

    @nlohmann
    OwnerAuthor
  2. RUSLoker commented on May 16, 2026

    @RUSLoker
    Contributor

    Took it on.

  3. nlohmann commented on May 16, 2026

    @nlohmann
    OwnerAuthor

    It may just be a Valgrind quirk.

  4. milestone-17 commented on May 16, 2026

    @milestone-17

    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!

  5. nlohmann commented on May 16, 2026

    @nlohmann
    OwnerAuthor

    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!

    The ticket is already assigned and a PR is created.

  6. milestone-17 commented on May 16, 2026

    @milestone-17

    Thanks,Is my error

  7. added this to the Release 3.12.1 milestone on May 17, 2026
  8. added a commit that references this issue on May 17, 2026
    4e5fa3b
  9. added a commit that references this issue on May 19, 2026
    54b42e3
  10. added a commit that references this issue on Sep 21, 2026
    b032dab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind: bugsolution: proposed fixa fix for the issue has been proposed and waits for confirmation

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions