From cbfa7e51e31c7ff50fb6bb963368f3a7a76d8871 Mon Sep 17 00:00:00 2001
From: Rachel Barker <[EMAIL REDACTED]>
Date: Mon, 19 Feb 2024 21:38:26 +0000
Subject: [PATCH] Silence a spurious compiler warning
In some configurations, when using gcc 13.2.0, the compiler can
warn that the variable `error` in sync_fpmt_workers may be used
without being initialized.
This is a spurious warning - in fact, the compiler seems to be
able to tell that this code is fine in normal builds, and only
produces a warning when building with optimizations and assertions
both enabled, e.g.:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DAOM_EXTRA_C_FLAGS="-UNDEBUG"
Prevent this warning by adding an explicit initializer.
Change-Id: I7fffcec2cdc6985f9c5767aaa307906d5c2495c1
---
av1/encoder/ethread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index ccb38f75a..5287ded3d 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -1417,7 +1417,7 @@ static AOM_INLINE void sync_fpmt_workers(AV1_PRIMARY *ppi,
int num_workers = ppi->p_mt_info.p_num_workers;
int had_error = 0;
// Points to error in the earliest display order frame in the parallel set.
- const struct aom_internal_error_info *error;
+ const struct aom_internal_error_info *error = NULL;
// Encoding ends.
for (int i = num_workers - 1; i >= 0; --i) {