Skip to content

Commit

Permalink
Fix 'maybe unitialized' error (#19)
Browse files Browse the repository at this point in the history
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]
````
  • Loading branch information
mikee47 authored Jun 11, 2024
1 parent c8f2489 commit 21ac3e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions jerryscript.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 21ac3e0

Please sign in to comment.