# aom: Silence a spurious compiler warning

**URL:** <https://discourse.libsdl.org/t/aom-silence-a-spurious-compiler-warning/49351>\
**Category:** SDL Commits\
**Created:** [February 20, 2024, 10:24pm UTC](https://discourse.libsdl.org/t/aom-silence-a-spurious-compiler-warning/49351 "2024-02-20T22:24:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [February 20, 2024, 10:24pm UTC](https://discourse.libsdl.org/t/aom-silence-a-spurious-compiler-warning/49351/1 "2024-02-20T22:24:09Z")

</div>

> <https://github.com/libsdl-org/aom/commit/cbfa7e51e31c7ff50fb6bb963368f3a7a76d8871>
>
> In some configurations, when using gcc 13.2.0, the compiler can
> warn that the va…riable \`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

```diff
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) {

```
