public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21750] New: GCC gives may be used uninitialized warning for a non-conditional initialised variable. (not a duplicate bug!)
@ 2005-05-25 12:57 j dot w dot r dot degoede at hhs dot nl
  2005-05-25 14:04 ` [Bug c/21750] " j dot w dot r dot degoede at hhs dot nl
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: j dot w dot r dot degoede at hhs dot nl @ 2005-05-25 12:57 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3136 bytes --]

I'm using Fedora Rawhide tree (FC4 develtree) the gcc rpm version is:
---
[hans@cq229 ~]$ rpm -q gcc
gcc-4.0.0-8
---

Gcc-version:
---
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)
---

Commandline triggering the bug:
---
gcc -o gglide.o -Wall -W -I. -I../../incsrc -I../../minihwc -I../../cinit
-I../../../swlibs/fxmisc -I../../../swlibs/newpci/pcilib
-I../../../swlibs/fxmemmap -I../../../swlibs/texus2/lib -D__linux__ -DDRI_BUILD
-DGLIDE3 -DGLIDE3_ALPHA -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC
-DGLIDE_PACKED_RGB=0 -DGLIDE_PACKET3_TRI_SETUP=1 -DGLIDE_TRI_CULLING=1
-DUSE_PACKET_FIFO=1 -DH3 -DFX_GLIDE_H5_CSIM=1 -DFX_GLIDE_NAPALM=1 -DGLIDE_PLUG
-DGLIDE_SPLASH -DHAVE_TEXUS2 -DGL_AMD3D -DGL_MMX -DGL_SSE -DGL_SSE2 -DGL_X86 -O2
-g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
-fasynchronous-unwind-tables -Wno-unused-parameter -save-temps -c gglide.c
---

Compiling gglide.c with the above cmdline results in the following warnings:
---
gglide.c: In function ‘_grBufferClear2D’:
gglide.c:957: warning: ‘clip0min’ may be used uninitialized in this function
gglide.c:964: warning: ‘height’ may be used uninitialized in this function
gglide.c:964: warning: ‘width’ may be used uninitialized in this function
gglide.c:957: warning: ‘command’ may be used uninitialized in this function
---

I've attached an .i file as instructed. line 957 => 7312 in the .i file.

Notice that command, width and height get initialised unconditional before use.
(the offsetoff use is use of a member of a struct with the same name not of the
variable).


I've seen this same bug in another file too. The strange thing is that moving
the "do { } while(0);" which contains "*_regGroupFifoPtr++ = ((height << 16) |
width);" up a bit to line 7404, which moves it over a block which doesn't touch
width or height makes the warning for width and height go away.

I've seen the same thing in the other file moving the code using the var up over
a (big) block which doesn't touch the var in any way makes the warning go away.
It is as if gcc forgets that the var has been initialised if it isn't used for a
number of lines.

-- 
           Summary: GCC gives may be used uninitialized warning for a non-
                    conditional initialised variable. (not a duplicate bug!)
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: j dot w dot r dot degoede at hhs dot nl
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21750


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-21750-10702@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2005-11-26 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-25 12:57 [Bug c/21750] New: GCC gives may be used uninitialized warning for a non-conditional initialised variable. (not a duplicate bug!) j dot w dot r dot degoede at hhs dot nl
2005-05-25 14:04 ` [Bug c/21750] " j dot w dot r dot degoede at hhs dot nl
2005-05-25 18:34 ` [Bug middle-end/21750] " pinskia at gcc dot gnu dot org
2005-08-09 15:59 ` James dot Juran at baesystems dot com
     [not found] <bug-21750-10702@http.gcc.gnu.org/bugzilla/>
2005-11-26  7:40 ` gdr at gcc dot gnu dot org
2005-11-26 16:39 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).