From be9719cfaf87073172abf2f43ec852682124b74d Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Thu, 20 Jun 2024 17:26:14 -0700 Subject: [PATCH] =?UTF-8?q?Fixed=20=E2=80=98length=E2=80=99=20may=20be=20u?= =?UTF-8?q?sed=20in=20Array.prototype.pop().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/njs_value_conversion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/njs_value_conversion.h b/src/njs_value_conversion.h index f5a0e6767..24483aa27 100644 --- a/src/njs_value_conversion.h +++ b/src/njs_value_conversion.h @@ -17,7 +17,7 @@ njs_value_to_number(njs_vm_t *vm, njs_value_t *value, double *dst) 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;