Commit c28f593
opt: Fix build issue with gcc 16 (replaeces PR KhronosGroup#6542) (KhronosGroup#6567)
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.
Co-authored-by: José Expósito <[email protected]>1 parent 6b956f3 commit c28f593
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
| 546 | + | |
| 547 | + | |
547 | 548 | | |
548 | 549 | | |
549 | 550 | | |
| |||
0 commit comments