[Bug target/11371] New: bogus warning and/or mis-optimization on ia64
debian-gcc at lists dot debian dot org
gcc-bugzilla@gcc.gnu.org
Sun Jun 29 11:01:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11371
Summary: bogus warning and/or mis-optimization on ia64
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: debian-gcc at lists dot debian dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: ia64-linux
GCC host triplet: ia64-linux
GCC target triplet: ia64-linux
[forwarded from http://bugs.debian.org/195834]
| troup@merulo:~/gdbm-1.8.3$ gcc -O2 -Wall -c gdbmopen.c
| gdbmopen.c: In function `gdbm_open':
| gdbmopen.c:15: warning: `lock_val' might be used uninitialized in this function
| fstat (dbf->desc, &file_stat);
|
| if ((flags & GDBM_OPENMASK) == GDBM_READER)
| {
| if (dbf->file_locking)
| {
| struct flock flock;
| flock.l_type = F_RDLCK;
| flock.l_whence = SEEK_SET;
| flock.l_start = flock.l_len = 0L;
| lock_val = fcntl (dbf->desc, F_SETLK, &flock);
| }
| }
| else if (dbf->file_locking)
| {
| struct flock flock;
| flock.l_type = F_WRLCK;
| flock.l_whence = SEEK_SET;
| flock.l_start = flock.l_len = 0L;
| lock_val = fcntl (dbf->desc, F_SETLK, &flock);
| }
| if (dbf->file_locking && (lock_val != 0))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| {
| return NULL;
| }
I think this warning is bogus because a) it only happens on ia64
(AFAICT, it doesn't happen on arm, i386 or hppa, at least), b) it only
happens with optimization turned on (disappears with -O0) and
c) if the (entirely unrelated) fstat call is commented out, the
warning disappears. I also think that it's clear from the code above
that lock_val couldn't be used uninitialized unless I'm missing
something embarrassingly obvious. Unfortunately I haven't been able
to determine if it's just a bogus warning or if the code's actually
being mis-compiled.
This isn't a regression, all previous versions of gcc (2.96, 3.0 and
3.2) for ia64 have the same problem and gcc-snapshot (20030531-2)
doesn't fix it.
http://people.debian.org/~troup/gcc/gdbm/ contains gdbmopen.{c,i},
fixed-gdbmopen.{c,i} (i.e. with the fstat commented out) and
orig-gdbmopen.{c,i} (the unreduced original file from gdbm 1.8.3).
More information about the Gcc-bugs
mailing list