details: https://hg.nginx.org/njs/rev/146d4699a4c4 branches: changeset: 2362:146d4699a4c4 user: Dmitry Volyntsev <xei...@nginx.com> date: Thu Jun 20 17:26:14 2024 -0700 description: Fixed ‘length’ may be used uninitialized in Array.prototype.pop().
When building by GCC with -O3 and -flto flags the following warning was reported: src/njs_array.c: In function ‘njs_array_prototype_pop’: src/njs_array.c:1009:8: error: ‘length’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1009 | if (length == 0) { | ^ Returning a specific code in njs_value_to_number() helps GCC to infer that there are only 2 return values are possible and both of them are handled. diffstat: src/njs_value_conversion.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 8b182df14819 -r 146d4699a4c4 src/njs_value_conversion.h --- a/src/njs_value_conversion.h Wed Jun 12 23:31:08 2024 -0700 +++ b/src/njs_value_conversion.h Thu Jun 20 17:26:14 2024 -0700 @@ -17,7 +17,7 @@ njs_value_to_number(njs_vm_t *vm, njs_va if (njs_slow_path(!njs_is_primitive(value))) { ret = njs_value_to_primitive(vm, &primitive, value, 0); if (njs_slow_path(ret != NJS_OK)) { - return ret; + return NJS_ERROR; } value = &primitive; _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel