Menu

TestCondition::alwaysTrue, TestCondition::alwaysTrueContainer fail on some platforms

2023-09-10
2025-08-30
  • Wolfgang Stöggl

    Hi,
    in the meantime, there are 2 failing tests. In the initially reported bug, it was one [1].
    Cppcheck version: 2.12.0

    Under Fedora, the failing style tests occur under aarch64, ppc64le and s390x. The following architectures are OK: i686, x86_64.

    Output from a current build log (e.g. aarch64) [2]:

    Number of tests: 4426Number of todos: 331
    Tests failed: 2
    /builddir/build/BUILD/cppcheck-2.12.0/test/testcondition.cpp:4501(TestCondition::alwaysTrue): Assertion failed.
    Expected:
    [test.cpp:6]: (style) Condition 'o[1]=='\0'' is always false\n
    Actual:
    [test.cpp:4] -> [test.cpp:6]: (style) Condition 'o[1]=='\0'' is always false\n


    /builddir/build/BUILD/cppcheck-2.12.0/test/testcondition.cpp:5014(TestCondition::alwaysTrueContainer): Assertion failed.
    Expected:
    [test.cpp:5]: (style) Condition 'buffer.back()=='\0'' is always false\n
    Actual:
    [test.cpp:3] -> [test.cpp:5]: (style) Condition 'buffer.back()=='\0'' is always false\n


    Best regards
    Wolfgang
    [1] https://trac.cppcheck.net/ticket/11537[2] https://koji.fedoraproject.org/koji/taskinfo?taskID=105994092

     
    • Wolfgang Stöggl

      As a workaround for now, -fsigned-char can be added to CXXFLAGS.
      This makes all tests pass also on aarch64, ppc64le and s390x, where char is unsigned by default.

       
  • Wolfgang Stöggl

    Hi,

    since 2.18.0 (also in 2.18.2), the test TestCondition is failing again on aarch64, ppc64le and s390x, where char is unsigned by default.

    Tests failed: 2
    /builddir/build/BUILD/cppcheck-2.18.2-build/cppcheck-2.18.2/test/testcondition.cpp:4586(TestCondition::alwaysTrue): Assertion failed. 
    Expected: 
    [test.cpp:4] -> [test.cpp:6]: (style) Condition 'o[1]=='\0'' is always false [knownConditionTrueFalse]\n
    Actual: 
    [test.cpp:4:25] -> [test.cpp:6:18]: (style) Condition 'o[1]=='\0'' is always false [knownConditionTrueFalse]\n
    _____
    /builddir/build/BUILD/cppcheck-2.18.2-build/cppcheck-2.18.2/test/testcondition.cpp:5326(TestCondition::alwaysTrueContainer): Assertion failed. 
    Expected: 
    [test.cpp:3] -> [test.cpp:5]: (style) Condition 'buffer.back()=='\0'' is always false\n
    Actual: 
    [test.cpp:3:22] -> [test.cpp:5:22]: (style) Condition 'buffer.back()=='\0'' is always false [knownConditionTrueFalse]\n
    _____
    

    As a workaround, -fsigned-char can be added to CXXFLAGS.

     
  • CHR

    CHR - 2025-08-30
     
    • Wolfgang Stöggl

      Thanks for the quick reply.
      Would you mind adding this fix also to the 2.18.x branch?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.