Pacman

Historical bug tracker for the Pacman package manager.

The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues

This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
Tasklist

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
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 4.1.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

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

Closed by  Allan McRae (Allan)
Wednesday, 06 November 2013, 09:43 GMT
Reason for closing:  Not a bug
Comment by Allan McRae (Allan) - Wednesday, 06 November 2013, 09:21 GMT
You will have to give some actual details of your build environment here. The full configure and build output.

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
Comment by Daniel YC Lin (dlin) - Wednesday, 06 November 2013, 09:38 GMT
I just make the 4.1.2 source. (under sh4 CPU arch)
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"
Comment by Allan McRae (Allan) - Wednesday, 06 November 2013, 09:43 GMT
Ah... gcc-4.2. That will be a false positive.

If you can replicate with a version of gcc supported by the gcc maintainers (4.7 and above), reopen the bug.
Comment by Daniel YC Lin (dlin) - Wednesday, 06 November 2013, 10:14 GMT
I did a code review. I think the bug exist there.
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"
Comment by Allan McRae (Allan) - Wednesday, 06 November 2013, 10:27 GMT
I reviewed every warning in the initial report. All are false positives.
Comment by Daniel YC Lin (dlin) - Wednesday, 06 November 2013, 14:26 GMT
Thanks Allan, you are right. I review the code again.
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.

Loading...