public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23648] New: Spurious uninitialized variable warnings at -O1 and higher
@ 2005-08-31  7:09 t dot starling at physics dot unimelb dot edu dot au
  2005-08-31  7:16 ` [Bug c++/23648] " t dot starling at physics dot unimelb dot edu dot au
  2005-08-31 12:31 ` [Bug target/23648] " pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: t dot starling at physics dot unimelb dot edu dot au @ 2005-08-31  7:09 UTC (permalink / raw)
  To: gcc-bugs

The compiler issues spurious warnings such as "warning: '__cur' might be used
uninitialized in this function", where on the corresponding line, __cur is the
lvalue in an assignment. The warnings are not issued at -O0. I noticed this
problem when dealing with nested STL containers. 

This is not a duplicate of bug 5035.

Here is the test code: 

#include <vector>
#include <set>

int main(int, char**)
{
	std::vector<std::vector<std::set<int> > > basis;
	basis.clear();	
	return 0;
}

I'll attach the preprocessed output. Command line and compiler output follows:

% g++ -v -save-temps -Wall -o uninitialized -O2 uninitialized.cc 
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc --enable-nls
--without-included-gettext --enable-version-specific-runtime-libs --without-x
--enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter
--disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm
--disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization
--enable-libstdcxx-debug : (reconfigured) 
Thread model: posix
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/cc1plus.exe -E -quiet -v -D__CYGWIN32__
-D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api -idirafter
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include/w32api
uninitialized.cc -mtune=pentiumpro -Wall -O2 -o uninitialized.ii
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/include"
ignoring duplicate directory
"/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/i686-pc-cygwin
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward
 /usr/local/include
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include
 /usr/include
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api
End of search list.
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/cc1plus.exe -fpreprocessed uninitialized.ii
-quiet -dumpbase uninitialized.cc -mtune=pentiumpro -auxbase uninitialized -O2
-Wall -version -o uninitialized.s
GNU C++ version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) (i686-pc-cygwin)
        compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12, using dmd
0.125).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32702
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_vector.h: In member
function `std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const
std::vector<_Tp, _Alloc>&) [with _Tp = std::set<int, std::less<int>,
std::allocator<int> >, _Alloc = std::allocator<std::set<int, std::less<int>,
std::allocator<int> > >]':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_vector.h:715: warning:
'__result' might be used uninitialized in this function
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_uninitialized.h:82:
warning: '__cur' might be used uninitialized in this function
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_uninitialized.h:82:
warning: '__cur' might be used uninitialized in this function
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/as.exe -o
uninitialized.o uninitialized.s
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/collect2.exe -Bdynamic
--dll-search-prefix=cyg -o uninitialized.exe
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../crt0.o
-L/usr/lib/gcc/i686-pc-cygwin/3.4.4 -L/usr/lib/gcc/i686-pc-cygwin/3.4.4
-L/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../.. uninitialized.o -lstdc++ -lgcc
-lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc

-- 
           Summary: Spurious uninitialized variable warnings at -O1 and
                    higher
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: t dot starling at physics dot unimelb dot edu dot au
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/23648] Spurious uninitialized variable warnings at -O1 and higher
  2005-08-31  7:09 [Bug c++/23648] New: Spurious uninitialized variable warnings at -O1 and higher t dot starling at physics dot unimelb dot edu dot au
@ 2005-08-31  7:16 ` t dot starling at physics dot unimelb dot edu dot au
  2005-08-31 12:31 ` [Bug target/23648] " pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: t dot starling at physics dot unimelb dot edu dot au @ 2005-08-31  7:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From t dot starling at physics dot unimelb dot edu dot au  2005-08-31 07:08 -------
Created an attachment (id=9629)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9629&action=view)
Preprocessed test case


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/23648] Spurious uninitialized variable warnings at -O1 and higher
  2005-08-31  7:09 [Bug c++/23648] New: Spurious uninitialized variable warnings at -O1 and higher t dot starling at physics dot unimelb dot edu dot au
  2005-08-31  7:16 ` [Bug c++/23648] " t dot starling at physics dot unimelb dot edu dot au
@ 2005-08-31 12:31 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-31 12:31 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |target
           Keywords|                            |diagnostic


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/23648] Spurious uninitialized variable warnings at -O1 and higher
       [not found] <bug-23648-11274@http.gcc.gnu.org/bugzilla/>
@ 2005-11-26  7:47 ` gdr at gcc dot gnu dot org
  0 siblings, 0 replies; 4+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-11-26  7:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from gdr at gcc dot gnu dot org  2005-11-26 07:47 -------
With mailine compiler (GCC-4.2.x), I cannot reproduce the reported behaviour.

-- Gaby


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at gcc dot gnu dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-31  7:09 [Bug c++/23648] New: Spurious uninitialized variable warnings at -O1 and higher t dot starling at physics dot unimelb dot edu dot au
2005-08-31  7:16 ` [Bug c++/23648] " t dot starling at physics dot unimelb dot edu dot au
2005-08-31 12:31 ` [Bug target/23648] " pinskia at gcc dot gnu dot org
     [not found] <bug-23648-11274@http.gcc.gnu.org/bugzilla/>
2005-11-26  7:47 ` gdr 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).