From 98ac2d7ee5e697c1f9830c63d6e1d4d5388729b3 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Mon, 2 Jun 2025 19:08:27 -0700 Subject: [PATCH] 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, -- 2.47.3