xiph / xiph/opus

Uninitialized warning for `quant_LTP_gains.c`: `res_nrg_Q15`

Open
#207 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
3.3k
Forks
808
PR merge metrics
No merged PRs in 30d

Description

When compiling opus for ESP32 this file has some maybe uninitialized portion throwing warnings, for me treated as errors:

...
-MF esp-idf/opus/CMakeFiles/__idf_opus.dir/opus/silk/quant_LTP_gains.c.obj.d -o esp-idf/opus/CMakeFiles/__idf_opus.dir/opus/silk/quant_LTP_gains.c.obj   -c ../components/opus/opus/silk/quant_LTP_gains.c
../components/opus/opus/silk/quant_LTP_gains.c: In function 'silk_quant_LTP_gains':
../components/opus/opus/silk/quant_LTP_gains.c:127:21: error: 'res_nrg_Q15' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         res_nrg_Q15 = silk_RSHIFT32( res_nrg_Q15, 2 );
cc1: some warnings being treated as errors
...

Setting it to zero worked as a workaround for me.

Wish: Please make sure this is set to the correct initial value.
Cheers for your work 👍

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in silk/quant_LTP_gains.c around line 127 and trace the paths that assign res_nrg_Q15 before its shift. Reproduce the ESP32 build with warnings treated as errors, then verify the warning is gone without changing the intended result.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.