Skip to content

Fails to build with GCC 16 #1016

@sergiodj

Description

@sergiodj

Hi there,

cJSON fails to build with GCC 16 on GNU/Linux:

In file included from /home/build/tests/unity/src/unity.h:16,
                 from /home/build/tests/misc_tests.c:28:
/home/build/tests/misc_tests.c: In function 'cjson_set_valuestring_should_return_null_if_strings_overlap':
/home/build/tests/misc_tests.c:504:22: error: 'strcmp' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
  504 |     TEST_ASSERT_TRUE(strcmp(str, "bcde") == 0);
      |                      ^~~~~~~~~~~~~~~~~~~
/home/build/tests/unity/src/unity_internals.h:652:102: note: in definition of macro 'UNITY_TEST_ASSERT'
  652 | #define UNITY_TEST_ASSERT(condition, line, message)                                              if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}
      |                                                                                                      ^~~~~~~~~
/home/build/tests/misc_tests.c:504:5: note: in expansion of macro 'TEST_ASSERT_TRUE'
  504 |     TEST_ASSERT_TRUE(strcmp(str, "bcde") == 0);
      |     ^~~~~~~~~~~~~~~~
cc1: note: source object is likely at address zero
cc1: all warnings being treated as errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions