[njs] Fixed gcc compilation with O3 optimization level.
noreply at nginx.com
noreply at nginx.com
Wed Jun 4 23:56:02 UTC 2025
details: https://github.com/nginx/njs/commit/98ac2d7ee5e697c1f9830c63d6e1d4d5388729b3
branches: master
commit: 98ac2d7ee5e697c1f9830c63d6e1d4d5388729b3
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Mon, 2 Jun 2025 19:08:27 -0700
description:
Fixed gcc compilation with O3 optimization level.
---
src/qjs.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/qjs.c b/src/qjs.c
index 7993de1b..9c0fcdb4 100644
--- a/src/qjs.c
+++ b/src/qjs.c
@@ -911,6 +911,11 @@ qjs_to_bytes(JSContext *ctx, qjs_bytes_t *bytes, JSValueConst value)
goto string;
}
+ /* GCC complains about uninitialized variables. */
+
+ byte_offset = 0;
+ byte_length = 0;
+
val = JS_GetTypedArrayBuffer(ctx, value, &byte_offset, &byte_length, NULL);
if (!JS_IsException(val)) {
bytes->start = JS_GetArrayBuffer(ctx, &bytes->length, val);
@@ -967,6 +972,11 @@ qjs_typed_array_data(JSContext *ctx, JSValueConst value, njs_str_t *data)
size_t byte_offset, byte_length;
JSValue ab;
+ /* GCC complains about uninitialized variables. */
+
+ byte_offset = 0;
+ byte_length = 0;
+
/* TODO: DataView. */
ab = JS_GetTypedArrayBuffer(ctx, value, &byte_offset, &byte_length,
More information about the nginx-devel
mailing list