capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.

Home Page:http://www.capstone-engine.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HPPADisassembler: more unitialized variables

XVilka opened this issue · comments

@R33v0LT please take a look:

../subprojects/capstone-next/arch/HPPA/HPPADisassembler.c:2505:2: error: variable 'sop' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
        default:
        ^~~~~~~
../subprojects/capstone-next/arch/HPPA/HPPADisassembler.c:2508:30: note: uninitialized use occurs here
        push_int_modifier(hppa_ext, sop);
                                    ^~~
../subprojects/capstone-next/arch/HPPA/HPPADisassembler.c:2486:14: note: initialize the variable 'sop' to silence this warning
        uint32_t sop;
                    ^
                     = 0
../subprojects/capstone-next/arch/HPPA/HPPADisassembler.c:2836:15: error: variable 'subop' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                        } else if (class == 3) {
                                   ^~~~~~~~~~
../subprojects/capstone-next/arch/HPPA/HPPADisassembler.c:2846:12: note: uninitialized use occurs here
                                       subop, ud->mode);
                                       ^~~~~
../subprojects/capstone-next/arch/HPPA/HPPADisassembler.c:2836:11: note: remove the 'if' if its condition is always true
                        } else if (class == 3) {
                               ^~~~~~~~~~~~~~~~
../subprojects/capstone-next/arch/HPPA/HPPADisassembler.c:2794:16: note: initialize the variable 'subop' to silence this warning
        uint32_t subop;
                      ^
                       = 0
2 errors generated.

That is strange. I've already fixed those errors in #2309.
I've checked one more time. I am able to compile latest capstone:next with clang and necessary flags (including -Werror,-Wsometimes-uninitialized)

Yeah, that is because I was stupid. Check the variable renaming in the CMakeLists.txt from #2312.

I had a typo there and we did not recognize it the whole time, because cmake is not complaining about uninitialized variables. So we basically ran the CI without warnings enabled.

Closed with #2311