Skip to content

opt: Fix build issue with gcc 16#6542

Open
JoseExposito wants to merge 1 commit intoKhronosGroup:mainfrom
JoseExposito:fix-gcc16-build-error
Open

opt: Fix build issue with gcc 16#6542
JoseExposito wants to merge 1 commit intoKhronosGroup:mainfrom
JoseExposito:fix-gcc16-build-error

Conversation

@JoseExposito
Copy link

Compiling with gcc 16 throws this error:

FAILED: [code=1] source/opt/CMakeFiles/SPIRV-Tools-opt.dir/decoration_manager.cpp.o
source/opt/decoration_manager.cpp: In member function
  ‘spvtools::opt::analysis::DecorationManager::CloneDecorations(unsigned int, unsigned int)’:
source/opt/decoration_manager.cpp:546:27: error:
  ‘MEM[(unsigned int &)&op + 24]’ may be used uninitialized [-Werror=maybe-uninitialized]

  546 |           if (op.words[0] == from) {  // add new pair of operands: (to, literal)
source/opt/decoration_manager.cpp:545:19: note: ‘op’ declared here
  545 |           Operand op = inst->GetOperand(i);
      |                   ^~
cc1plus: all warnings being treated as errors

Make sure that the vector is not empty before using it.


Found while packaging it for Fedora:

https://koji.fedoraproject.org/koji/taskinfo?taskID=142384664

@CLAassistant
Copy link

CLAassistant commented Feb 16, 2026

CLA assistant check
All committers have signed the CLA.

Compiling with gcc 16 throws this error:

    FAILED: [code=1] source/opt/CMakeFiles/SPIRV-Tools-opt.dir/decoration_manager.cpp.o
    source/opt/decoration_manager.cpp: In member function
      ‘spvtools::opt::analysis::DecorationManager::CloneDecorations(unsigned int, unsigned int)’:
    source/opt/decoration_manager.cpp:546:27: error:
      ‘MEM[(unsigned int &)&op + 24]’ may be used uninitialized [-Werror=maybe-uninitialized]

      546 |           if (op.words[0] == from) {  // add new pair of operands: (to, literal)
    source/opt/decoration_manager.cpp:545:19: note: ‘op’ declared here
      545 |           Operand op = inst->GetOperand(i);
          |                   ^~
    cc1plus: all warnings being treated as errors

Make sure that the vector is not empty before using it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants