FS#37662 - pacman remove all warning message(variable may be used uninitialized)
Attached to Project:
Pacman
Opened by Daniel YC Lin (dlin) - Wednesday, 06 November 2013, 07:04 GMT
Last edited by Allan McRae (Allan) - Wednesday, 06 November 2013, 09:43 GMT
Opened by Daniel YC Lin (dlin) - Wednesday, 06 November 2013, 07:04 GMT
Last edited by Allan McRae (Allan) - Wednesday, 06 November 2013, 09:43 GMT
|
Details
Description:
Just try to build pacman 4.1.2, here are some compile warning. I don't know does that cause bug in the future. But as a good practices, keep the code without such warning is safer. signing.c: In function '_alpm_extract_keyid': signing.c:970: warning: 'blen' may be used uninitialized in this function conf.c: In function ‘setrepeatingoption’: conf.c:457: warning: ‘saveptr’ may be used uninitialized in this function package.c: In function ‘dump_pkg_search’: package.c:371: warning: ‘db_local’ may be used uninitialized in this function Additional info: * package version(s) pacman 4.1.2 * config and/or log files etc. Steps to reproduce: |
This task depends upon
I can not replicate when building with the --enable-warningflags configure option that enables all these warnings:
-Wall -Wcast-align -Wclobbered -Wempty-body -Wfloat-equal -Wformat-nonliteral -Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-field-initializers -Wmissing-parameter-type -Wmissing-prototypes -Wold-style-declaration -Woverride-init -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-compare -Wstrict-aliasing -Wstrict-overflow=5 -Wstrict-prototypes -Wtype-limits -Wuninitialized -Wunused-but-set-parameter -Wunused-parameter -Wwrite-strings
The warning won't stop build except you put -Werror
You could clean the code and rebuild again, I guess you'll see that.
$ gcc --version
gcc (GCC) 4.2.4 (snapshot) (STMicroelectronics/Linux Base 4.2.4-76)
$ grep FLAG /etc/makepkg.conf
CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-O2 -pipe"
CXXFLAGS="-O2 -pipe"
LDFLAGS=""
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
If you can replicate with a version of gcc supported by the gcc maintainers (4.7 and above), reopen the bug.
Even I don't know why the compile warning not show.
I've test again on x86_64. The makepkg build system won't show error, even I did
make clean
./configure
make CFLAGS="-Wall -Werror -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
And I found the newer gcc is smarter. Those warnings are not necessary.
In the case only 4 values 0,1,2,3. So, it don't require show warning.
So, it is safe to close this issue.