public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36168]  New: Incorrect (and strange) warnings with -Wuninitialized
@ 2008-05-07  9:34 martin at mpa-garching dot mpg dot de
  2008-05-07  9:35 ` [Bug c++/36168] " martin at mpa-garching dot mpg dot de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: martin at mpa-garching dot mpg dot de @ 2008-05-07  9:34 UTC (permalink / raw)
  To: gcc-bugs

When compiling the attached testcase with current mainline, bogus warnings are
emitted:

/scratch/martin/splotch>g++ -v -O -Wuninitialized bug.ii
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /scratch/martin/gcc/configure
--prefix=/afs/mpa/data/martin/ugcc --with-mpfr-include=/usr/include
--with-mpfr-lib=/usr/lib --with-gmp-include=/usr/include
--with-gmp-lib=/usr/lib --enable-languages=c++,fortran
--enable-checking=release
Thread model: posix
gcc version 4.4.0 20080507 (experimental) [trunk revision 135032] (GCC) 
COLLECT_GCC_OPTIONS='-v' '-O' '-Wuninitialized' '-shared-libgcc'
'-mtune=generic'
 /afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.4.0/cc1plus
-fpreprocessed bug.ii -quiet -dumpbase bug.ii -mtune=generic -auxbase bug -O
-Wuninitialized -version -o /tmp/ccSh8Ooh.s
GNU C++ (GCC) version 4.4.0 20080507 (experimental) [trunk revision 135032]
(i686-pc-linux-gnu)
        compiled by GNU C version 4.4.0 20080507 (experimental) [trunk revision
135032], GMP version 4.2.1, MPFR version 2.3.1.
warning: GMP header version 4.2.1 differs from library version 4.2.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d49e4fa2e0d6ffd2b8e9abb2dcc5530c
In file included from splotch/splotch.cc:37,
                 from fullsplotch.cc:5:
./splotch/splotchutils.h: In member function 'void
splotch_renderer::render(const std::vector<particle2, std::allocator<particle2>
>&, arr2<RAYPP::COLOUR>&, bool, double)':
./splotch/splotchutils.h:132: warning: 'q.COLOUR8::r' may be used uninitialized
in this function
./splotch/splotchutils.h:132: warning: 'q.COLOUR8::g' may be used uninitialized
in this function
COLLECT_GCC_OPTIONS='-v' '-O' '-Wuninitialized' '-shared-libgcc'
'-mtune=generic'
 as -V -Qy -o /tmp/ccPwUfT2.o /tmp/ccSh8Ooh.s
GNU assembler version 2.18 (i686-pc-linux-gnu) using BFD version (GNU Binutils)
2.18
COMPILER_PATH=/afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.4.0/:/afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.4.0/:/afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/:/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.4.0/:/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/
LIBRARY_PATH=/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.4.0/:/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-O' '-Wuninitialized' '-shared-libgcc'
'-mtune=generic'
 /afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.4.0/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o
/usr/lib/crti.o
/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.4.0/crtbegin.o
-L/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.4.0
-L/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.4.0/../../..
/tmp/ccPwUfT2.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.4.0/crtend.o
/usr/lib/crtn.o

There are several funny things happening here:
 - in principle the compiler is able to detect that "q" will not be used
uninitialized; if I remove pieces of code somewhere completely different in the
testcase, the warning dieappears
 - the syntax "'q.COLOUR8::r' may be used uninitialized in this function" is
unexpected; typically the warnings look different
 - whether the warning is printed or not depends very sensitively on the
surrounding code, so it's very hard to produce a small testcase. I have the
feeling that it is only emitted if the processed function exceeds a certain
complexity; but this is just a guess.

I have observed this behaviour in older versions, back to (at least) 4.2, but
did not open a PR about it before, since I wasn't able to provide a good
testcase. I hope the attached one is not completely useless ...


-- 
           Summary: Incorrect (and strange) warnings with -Wuninitialized
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: martin at mpa-garching dot mpg dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2009-02-09 16:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-07  9:34 [Bug c++/36168] New: Incorrect (and strange) warnings with -Wuninitialized martin at mpa-garching dot mpg dot de
2008-05-07  9:35 ` [Bug c++/36168] " martin at mpa-garching dot mpg dot de
2008-05-07  9:44 ` pinskia at gcc dot gnu dot org
2008-05-07  9:51 ` pinskia at gcc dot gnu dot org
2008-05-07  9:52 ` martin at mpa-garching dot mpg dot de
2008-05-07  9:54 ` pinskia at gcc dot gnu dot org
2008-05-07  9:57 ` martin at mpa-garching dot mpg dot de
2008-05-07 10:13 ` manu at gcc dot gnu dot org
2008-08-29  3:53 ` manu at gcc dot gnu dot org
2008-12-28  5:13 ` pinskia at gcc dot gnu dot org
2009-02-09 16:13 ` [Bug c++/36168] bogus uninitialized warning (huge testcase) manu at gcc dot gnu dot org
2009-02-09 16:15 ` manu 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).