From 21ac3e053d2a63ebc1955f2a62c2978c7447e119 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 11 Jun 2024 09:18:06 +0100 Subject: [PATCH] Fix 'maybe unitialized' error (#19) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building with recent compilers flags the following error: ``` Sming/Libraries/jerryscript/jerryscript/jerry-core/ecma/base/ecma-helpers-string.c:1848:6: error: ‘string1_size_and_length[0]’ may be used uninitialized [-Werror=maybe-uninitialized] 1848 | if (string1_size_and_length[0] != string2_size_and_length[0] ```` --- jerryscript.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jerryscript.patch b/jerryscript.patch index 9fb7bf4..9960ee0 100644 --- a/jerryscript.patch +++ b/jerryscript.patch @@ -207,3 +207,16 @@ index 36c02277..94d0934f 100644 switch (code) { case ERR_OUT_OF_MEMORY: +diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c +index 12770f36..5ab67df2 100644 +--- a/jerry-core/ecma/base/ecma-helpers-string.c ++++ b/jerry-core/ecma/base/ecma-helpers-string.c +@@ -1835,7 +1835,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /**< ecma-st + const ecma_string_t *string2_p) /**< ecma-string */ + { + const lit_utf8_byte_t *utf8_string1_p, *utf8_string2_p; +- lit_utf8_size_t string1_size_and_length[2], string2_size_and_length[2]; ++ lit_utf8_size_t string1_size_and_length[2]={0}, string2_size_and_length[2]={0}; + + utf8_string1_p = ecma_compare_get_string_chars (string1_p, string1_size_and_length); + utf8_string2_p = ecma_compare_get_string_chars (string2_p, string2_size_and_length);