public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/39799]  New: missing 'may be used uninitialized' warning
@ 2009-04-17 17:55 alexvod at google dot com
  2009-04-17 20:56 ` [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: alexvod at google dot com @ 2009-04-17 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

The following code:

inline int foo(int x)
{
  return x;
}
static void bar(int a, int *ptr)
{
  do
  {
    int b;
    if (b < 40)
    {
      ptr[0] = b;
    }
    b += 1;
    ptr++;
  }
  while (--a != 0);
}
void foobar(int a, int *ptr)
{
  bar(foo(a), ptr);
}

generates correct warning when compiled by gcc 4.2.4:
$ gcc -O3 -Wall -Werror -c 1.c
cc1: warnings being treated as errors
1.c: In function ‘foobar’:
1.c:9: warning: ‘b’ may be used uninitialized in this function
1.c:9: note: ‘b’ was declared here

But it compiles without any warning with gcc 4.4.0. The bug reproduces on gcc
4.3.1 as well.


-- 
           Summary: missing 'may be used uninitialized' warning
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alexvod at google dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
@ 2009-04-17 20:56 ` rguenth at gcc dot gnu dot org
  2009-04-20  7:39 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-17 20:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-04-17 20:55 -------
This is because we zero-initialize uninitialized variables during inlining.
Honza, do you remember why we do this?

          /* By inlining function having uninitialized variable, we might
             extend the lifetime (variable might get reused).  This cause
             ICE in the case we end up extending lifetime of SSA name across
             abnormal edge, but also increase register pressure.

             We simply initialize all uninitialized vars by 0 except
             for case we are inlining to very first BB.  We can avoid
             this for all BBs that are not inside strongly connected
             regions of the CFG, but this is expensive to test.  */


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
          Component|regression                  |tree-optimization
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-17 20:55:52
               date|                            |
            Summary|missing 'may be used        |[4.3/4.4/4.5 Regression]
                   |uninitialized' warning      |missing 'may be used
                   |                            |uninitialized' warning
   Target Milestone|---                         |4.3.4


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
  2009-04-17 20:56 ` [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
@ 2009-04-20  7:39 ` jakub at gcc dot gnu dot org
  2009-04-20  9:32 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-20  7:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2009-04-20 07:39 -------
See PR31081 for details.


-- 


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
  2009-04-17 20:56 ` [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
  2009-04-20  7:39 ` jakub at gcc dot gnu dot org
@ 2009-04-20  9:32 ` rguenth at gcc dot gnu dot org
  2009-04-22 13:37 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-20  9:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-04-20 09:32 -------
Honza, if overlapping lifetimes are the problem instead of zero-initializing
uninitialized params we could instead create a new uninitialized variable for
them?


-- 


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
                   ` (2 preceding siblings ...)
  2009-04-20  9:32 ` rguenth at gcc dot gnu dot org
@ 2009-04-22 13:37 ` rguenth at gcc dot gnu dot org
  2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-22 13:37 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
                   ` (3 preceding siblings ...)
  2009-04-22 13:37 ` rguenth at gcc dot gnu dot org
@ 2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
  2010-05-22 18:32 ` [Bug tree-optimization/39799] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-08-04 12:30 -------
GCC 4.3.4 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.4                       |4.3.5


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5/4.6 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
                   ` (4 preceding siblings ...)
  2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
@ 2010-05-22 18:32 ` rguenth at gcc dot gnu dot org
  2010-06-30 14:17 ` bernds at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-22 18:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-05-22 18:13 -------
GCC 4.3.5 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.5                       |4.3.6


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5/4.6 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
                   ` (5 preceding siblings ...)
  2010-05-22 18:32 ` [Bug tree-optimization/39799] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
@ 2010-06-30 14:17 ` bernds at gcc dot gnu dot org
  2010-06-30 23:36 ` matt at use dot net
  2010-07-01 17:14 ` danglin at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-06-30 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from bernds at gcc dot gnu dot org  2010-06-30 14:17 -------
Subject: Bug 39799

Author: bernds
Date: Wed Jun 30 14:16:28 2010
New Revision: 161605

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161605
Log:
        PR tree-optimization/39799
        * tree-inline.c (remap_ssa_name): Initialize variable only if
        SSA_NAME_OCCURS_IN_ABNORMAL_PHI.

testsuite/
        PR tree-optimization/39799
        * c-c++-common/uninit-17.c: New test.


Added:
    trunk/gcc/testsuite/c-c++-common/uninit-17.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c


-- 


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5/4.6 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
                   ` (6 preceding siblings ...)
  2010-06-30 14:17 ` bernds at gcc dot gnu dot org
@ 2010-06-30 23:36 ` matt at use dot net
  2010-07-01 17:14 ` danglin at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: matt at use dot net @ 2010-06-30 23:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from matt at use dot net  2010-06-30 23:36 -------
Will this be backported to 4.4 and/or 4.5?


-- 


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


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

* [Bug tree-optimization/39799] [4.3/4.4/4.5/4.6 Regression] missing 'may be used uninitialized' warning
  2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
                   ` (7 preceding siblings ...)
  2010-06-30 23:36 ` matt at use dot net
@ 2010-07-01 17:14 ` danglin at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: danglin at gcc dot gnu dot org @ 2010-07-01 17:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from danglin at gcc dot gnu dot org  2010-07-01 17:14 -------
c-c++-common/uninit-17.c fails on hppa2.0w-hp-hpux11.11:

Executing on host: /test/gnu/gcc/objdir/gcc/xgcc -B/test/gnu/gcc/objdir/gcc/
/te
st/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c   -Wc++-compat  -O2
-Wunin
itialized -S  -o uninit-17.s    (timeout = 300)
/test/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c: In function 'foobar':
/test/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c:12:9: warning: 'b' is
u
sed uninitialized in this function [-Wuninitialized]
/test/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c:12:9: note: 'b' was
dec
lared here
output is:
/test/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c: In function 'foobar':
/test/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c:12:9: warning: 'b' is
u
sed uninitialized in this function [-Wuninitialized]
/test/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c:12:9: note: 'b' was
dec
lared here

PASS: c-c++-common/uninit-17.c  -Wc++-compat   (test for warnings, line 12)
FAIL: c-c++-common/uninit-17.c  -Wc++-compat   (test for warnings, line 14)
FAIL: c-c++-common/uninit-17.c  -Wc++-compat  (test for excess errors)
Excess errors:
/test/gnu/gcc/gcc/gcc/testsuite/c-c++-common/uninit-17.c:12:9: warning: 'b' is
u
sed uninitialized in this function [-Wuninitialized]


-- 

danglin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |danglin at gcc dot gnu dot
                   |                            |org


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


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

end of thread, other threads:[~2010-07-01 17:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-17 17:55 [Bug regression/39799] New: missing 'may be used uninitialized' warning alexvod at google dot com
2009-04-17 20:56 ` [Bug tree-optimization/39799] [4.3/4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
2009-04-20  7:39 ` jakub at gcc dot gnu dot org
2009-04-20  9:32 ` rguenth at gcc dot gnu dot org
2009-04-22 13:37 ` rguenth at gcc dot gnu dot org
2009-08-04 12:48 ` rguenth at gcc dot gnu dot org
2010-05-22 18:32 ` [Bug tree-optimization/39799] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
2010-06-30 14:17 ` bernds at gcc dot gnu dot org
2010-06-30 23:36 ` matt at use dot net
2010-07-01 17:14 ` danglin 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).