public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2
@ 2005-08-25 17:22 lennox at cs dot columbia dot edu
  2005-08-25 17:38 ` [Bug tree-optimization/23563] " lennox at cs dot columbia dot edu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: lennox at cs dot columbia dot edu @ 2005-08-25 17:22 UTC (permalink / raw)
  To: gcc-bugs

When I compile warn-thing.cpp (to be attached as soon as I've submitted this
bug) with gcc 4.0.2, I get the warning message

warn-thing.cpp:24: warning: 'variable' may be used uninitialized in this function

This warning appears to me to be incorrect, and did not occur with gcc 3.4.2.

The warning does not occur if optimization is not enabled.

The attached error output is from gcc version 4.0.2 20050728 (prerelease)
[FreeBSD] for i386-portbld-freebsd5.4, but I see the same results with gcc
version 4.0.2 20050806 (prerelease) (Debian 4.0.1-4) for i486-linux-gnu.

$ gcc40 -v -Wall -O2 -c warn-thing.cpp
Using built-in specs.
Target: i386-portbld-freebsd5.4
Configured with: ./..//gcc-4.0-20050728/configure --disable-nls
--with-system-zlib --with-libiconv-prefix=/usr/local --program-suffix=40
--libdir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2
--with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++/
--with-gmp=/usr/local --disable-shared --prefix=/usr/local i386-portbld-freebsd5.4
Thread model: posix
gcc version 4.0.2 20050728 (prerelease) [FreeBSD]
 /usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.0.2/cc1plus -quiet -v
warn-thing.cpp -quiet -dumpbase warn-thing.cpp -auxbase warn-thing -O2 -Wall
-version -o /var/tmp//ccjEgsIS.s
ignoring nonexistent directory
"/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/gcc/i386-portbld-freebsd5.4/4.0.2/../../../../i386-portbld-freebsd5.4/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++/
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++//i386-portbld-freebsd5.4
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/include/c++//backward
 /usr/local/include
 /usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.2/gcc/i386-portbld-freebsd5.4/4.0.2/include
 /usr/include
End of search list.
GNU C++ version 4.0.2 20050728 (prerelease) [FreeBSD] (i386-portbld-freebsd5.4)
        compiled by GNU C version 4.0.2 20050728 (prerelease) [FreeBSD].
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129460
warn-thing.cpp: In function 'void foo()':
warn-thing.cpp:24: warning: 'variable' may be used uninitialized in this function
 as -o warn-thing.o /var/tmp//ccjEgsIS.s

For comparison, here is the non-warning output of gcc 3.4:

$ gcc -v -Wall -O2 -c warn-thing.cpp
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.2 [FreeBSD] 20040728
 /usr/libexec/cc1plus -quiet -v -D_LONGLONG warn-thing.cpp -quiet -dumpbase
warn-thing.cpp -auxbase warn-thing -O2 -Wall -version -o /var/tmp//ccHHC2rw.s
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.4
 /usr/include/c++/3.4/backward
 /usr/include
End of search list.
GNU C++ version 3.4.2 [FreeBSD] 20040728 (i386-fbsdproj-freebsd)
        compiled by GNU C version 3.4.2 [FreeBSD] 20040728.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 /usr/bin/as -v -o warn-thing.o /var/tmp//ccHHC2rw.s
GNU assembler version 2.15 [FreeBSD] 2004-05-23 (i386-obrien-freebsd) using BFD
version 2.15 [FreeBSD] 2004-05-23

-- 
           Summary: False warning for uninitialized variable: regression
                    from 3.4.2
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lennox at cs dot columbia dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-portbld-freebsd5.4
  GCC host triplet: i386-portbld-freebsd5.4
GCC target triplet: i386-portbld-freebsd5.4


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


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

* [Bug tree-optimization/23563] False warning for uninitialized variable: regression from 3.4.2
  2005-08-25 17:22 [Bug tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2 lennox at cs dot columbia dot edu
@ 2005-08-25 17:38 ` lennox at cs dot columbia dot edu
  2005-08-25 17:49 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: lennox at cs dot columbia dot edu @ 2005-08-25 17:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lennox at cs dot columbia dot edu  2005-08-25 17:23 -------
Created an attachment (id=9585)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9585&action=view)
C++ source file that produces warning with GCC 4.0.2

This file does not #include any files, so I'm providing the .cpp not the .ii. 
The preprocessed file is identical except for whitespace and
preprocessor-inserted line markers.

-- 


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


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

* [Bug tree-optimization/23563] False warning for uninitialized variable: regression from 3.4.2
  2005-08-25 17:22 [Bug tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2 lennox at cs dot columbia dot edu
  2005-08-25 17:38 ` [Bug tree-optimization/23563] " lennox at cs dot columbia dot edu
@ 2005-08-25 17:49 ` pinskia at gcc dot gnu dot org
  2005-08-25 17:58 ` [Bug tree-optimization/23563] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2005-09-27 16:13 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-25 17:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-25 17:38 -------
The issue here is due to exceptions.  On the mainline we don't warn but I think I can find a testcase 
where we do.

-- 


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


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

* [Bug tree-optimization/23563] [4.0 Regression] False warning for uninitialized variable: regression from 3.4.2
  2005-08-25 17:22 [Bug tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2 lennox at cs dot columbia dot edu
  2005-08-25 17:38 ` [Bug tree-optimization/23563] " lennox at cs dot columbia dot edu
  2005-08-25 17:49 ` pinskia at gcc dot gnu dot org
@ 2005-08-25 17:58 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:13 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-25 17:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-25 17:48 -------
Well I right in saying this is due to exceptions but is wrong in saying I can reproduce this on the 
mainline.

It more has to do with not copying of the finally block (for the call of the deconstructor of stack_obj).

In 3.4.0 we copied the finally block in 4.0.2 we don't but in 4.1.0 we do again.

At -O2 we copy the finally block too.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|i386-portbld-freebsd5.4     |
   GCC host triplet|i386-portbld-freebsd5.4     |
 GCC target triplet|i386-portbld-freebsd5.4     |
           Keywords|                            |diagnostic, missed-
                   |                            |optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-25 17:48:53
               date|                            |
            Summary|False warning for           |[4.0 Regression] False
                   |uninitialized variable:     |warning for uninitialized
                   |regression from 3.4.2       |variable: regression from
                   |                            |3.4.2
   Target Milestone|---                         |4.0.2


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


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

* [Bug tree-optimization/23563] [4.0 Regression] False warning for uninitialized variable: regression from 3.4.2
  2005-08-25 17:22 [Bug tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2 lennox at cs dot columbia dot edu
                   ` (2 preceding siblings ...)
  2005-08-25 17:58 ` [Bug tree-optimization/23563] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-09-27 16:13 ` mmitchel at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:13 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

end of thread, other threads:[~2005-09-27 16:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-25 17:22 [Bug tree-optimization/23563] New: False warning for uninitialized variable: regression from 3.4.2 lennox at cs dot columbia dot edu
2005-08-25 17:38 ` [Bug tree-optimization/23563] " lennox at cs dot columbia dot edu
2005-08-25 17:49 ` pinskia at gcc dot gnu dot org
2005-08-25 17:58 ` [Bug tree-optimization/23563] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-09-27 16:13 ` mmitchel 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).