public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35609]  New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning
@ 2008-03-16 21:19 bunk at stusta dot de
  2008-03-16 21:30 ` [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bunk at stusta dot de @ 2008-03-16 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

<--  snip  -->

$ cat test.c
int foo, bar;

void decode_reloc(int reloc, int *is_alt)
{
  if (reloc >= 20)
      *is_alt = 1;
  else if (reloc >= 10)
      *is_alt = 0;
}

void testfunc()
{
  int alt_reloc;

  decode_reloc(foo, &alt_reloc);

  if (alt_reloc)
    bar = 42;
}
$ gcc -O2 -Wall -c test.c
test.c: In function ‘testfunc’:
test.c:17: warning: ‘alt_reloc’ is used uninitialized in this function
$ 

<--  snip  -->

A "may be used uninitialized in this function" warning might be appropriate
here, but gcc seems to wrongly think it can prove "alt_reloc" was for sure
uninitialized here.


-- 
           Summary: [4.3/4.4 Regression] bogus "is used uninitialized in
                    this function" warning
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bunk at stusta dot de


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


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

* [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
  2008-03-16 21:30 ` [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning pinskia at gcc dot gnu dot org
@ 2008-03-16 21:30 ` pinskia at gcc dot gnu dot org
  2008-03-16 21:33 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-16 21:30 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.3/4.4 Regression] bogus  |[4.3/4.4 Regression] "is
                   |"is used uninitialized in   |used uninitialized in this
                   |this function" warning      |function" should be may
                   |                            |warning
   Target Milestone|---                         |4.3.1


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


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

* [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
@ 2008-03-16 21:30 ` pinskia at gcc dot gnu dot org
  2008-03-16 21:30 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-16 21:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-03-16 21:30 -------
So Jump threading comes along and threads the jump for some reason makes the
PHI node go away.


-- 


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


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

* [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
  2008-03-16 21:30 ` [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning pinskia at gcc dot gnu dot org
  2008-03-16 21:30 ` pinskia at gcc dot gnu dot org
@ 2008-03-16 21:33 ` rguenth at gcc dot gnu dot org
  2008-03-18 16:54 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-16 21:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-03-16 21:32 -------
The warning works as designed, the PHI node in question that causes the
warning only has a single incoming edge:

testfunc ()
{
  int alt_reloc;
  int foo.0;

<bb 2>:
  foo.0_1 = foo;
  if (foo.0_1 > 19)
    goto <bb 5>;
  else
    goto <bb 3>;

<bb 3>:
  if (foo.0_1 > 9)
    goto <bb 6>;
  else
    goto <bb 4>;

<bb 4>:
  if (alt_reloc_4(D) != 0)
    goto <bb 5>;
  else
    goto <bb 6>;

<bb 5>:
  bar = 42;

<bb 6>:
  return;

}

we don't check whether the uninitialized use post-dominates the function
entry.  I don't know if we should.

This is just a case of 4.3 optimizing better than 4.2 which makes the
warning less precise.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-16 21:32:33
               date|                            |


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


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

* [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
                   ` (2 preceding siblings ...)
  2008-03-16 21:33 ` rguenth at gcc dot gnu dot org
@ 2008-03-18 16:54 ` rguenth at gcc dot gnu dot org
  2008-03-19 10:46 ` [Bug tree-optimization/35609] [4.3 " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-18 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-03-18 16:53 -------
While this is a regression the underlying problem was latent and thus this
should be an enhacement report.  But I'll have a look.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
           Severity|normal                      |enhancement
             Status|NEW                         |ASSIGNED
           Priority|P3                          |P4
   Last reconfirmed|2008-03-16 21:32:33         |2008-03-18 16:53:41
               date|                            |


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


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

* [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
                   ` (4 preceding siblings ...)
  2008-03-19 10:46 ` [Bug tree-optimization/35609] [4.3 " rguenth at gcc dot gnu dot org
@ 2008-03-19 10:46 ` rguenth at gcc dot gnu dot org
  2008-03-25 10:10 ` [Bug tree-optimization/35609] [4.3 " rguenth at gcc dot gnu dot org
  2008-03-25 10:11 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-19 10:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2008-03-19 10:45 -------
Subject: Bug 35609

Author: rguenth
Date: Wed Mar 19 10:44:52 2008
New Revision: 133341

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133341
Log:
2008-03-19  Richard Guenther  <rguenther@suse.de>

        PR middle-end/35609
        * tree-ssa.c (always_executed): New global flag.
        (warn_uninitialized_var): If !always_executed warn with "maybe"
        instead of "is".
        (execute_early_warn_uninitialized): Compute post-dominators.
        Initialize always_executed before processing each basic block.

        * gcc.dg/testsuite/uninit-15.c: New testcase.
        * gcc.dg/testsuite/uninit-16.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/uninit-15.c
    trunk/gcc/testsuite/gcc.dg/uninit-16.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa.c


-- 


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


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

* [Bug tree-optimization/35609] [4.3 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
                   ` (3 preceding siblings ...)
  2008-03-18 16:54 ` rguenth at gcc dot gnu dot org
@ 2008-03-19 10:46 ` rguenth at gcc dot gnu dot org
  2008-03-19 10:46 ` [Bug tree-optimization/35609] [4.3/4.4 " rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-19 10:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-03-19 10:45 -------
Fixed on the trunk.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.2.3                       |4.2.3 4.4.0
            Summary|[4.3/4.4 Regression] "is    |[4.3 Regression] "is used
                   |used uninitialized in this  |uninitialized in this
                   |function" should be may     |function" should be may
                   |warning                     |warning


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


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

* [Bug tree-optimization/35609] [4.3 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
                   ` (5 preceding siblings ...)
  2008-03-19 10:46 ` [Bug tree-optimization/35609] [4.3/4.4 " rguenth at gcc dot gnu dot org
@ 2008-03-25 10:10 ` rguenth at gcc dot gnu dot org
  2008-03-25 10:11 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-25 10:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-03-25 10:09 -------
And on the branch.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|4.2.3 4.4.0                 |4.2.3 4.4.0 4.3.1
         Resolution|                            |FIXED


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


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

* [Bug tree-optimization/35609] [4.3 Regression] "is used uninitialized in this function" should be may warning
  2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
                   ` (6 preceding siblings ...)
  2008-03-25 10:10 ` [Bug tree-optimization/35609] [4.3 " rguenth at gcc dot gnu dot org
@ 2008-03-25 10:11 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-25 10:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2008-03-25 10:10 -------
Subject: Bug 35609

Author: rguenth
Date: Tue Mar 25 10:09:22 2008
New Revision: 133507

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133507
Log:
2008-03-25  Richard Guenther  <rguenther@suse.de>

        Backport from mainline:
        2008-03-19  Richard Guenther  <rguenther@suse.de>

        PR middle-end/35609
        * tree-ssa.c (walk_data): New structure.
        (warn_uninitialized_var): If not always_executed warn with "maybe"
        instead of "is".
        (execute_early_warn_uninitialized): Compute post-dominators.
        Initialize always_executed before processing each basic block.

        * gcc.dg/testsuite/uninit-15.c: New testcase.
        * gcc.dg/testsuite/uninit-16.c: Likewise.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/uninit-15.c
      - copied unchanged from r133341, trunk/gcc/testsuite/gcc.dg/uninit-15.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/uninit-16.c
      - copied unchanged from r133341, trunk/gcc/testsuite/gcc.dg/uninit-16.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_3-branch/gcc/tree-ssa.c


-- 


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


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

end of thread, other threads:[~2008-03-25 10:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-16 21:19 [Bug c/35609] New: [4.3/4.4 Regression] bogus "is used uninitialized in this function" warning bunk at stusta dot de
2008-03-16 21:30 ` [Bug tree-optimization/35609] [4.3/4.4 Regression] "is used uninitialized in this function" should be may warning pinskia at gcc dot gnu dot org
2008-03-16 21:30 ` pinskia at gcc dot gnu dot org
2008-03-16 21:33 ` rguenth at gcc dot gnu dot org
2008-03-18 16:54 ` rguenth at gcc dot gnu dot org
2008-03-19 10:46 ` [Bug tree-optimization/35609] [4.3 " rguenth at gcc dot gnu dot org
2008-03-19 10:46 ` [Bug tree-optimization/35609] [4.3/4.4 " rguenth at gcc dot gnu dot org
2008-03-25 10:10 ` [Bug tree-optimization/35609] [4.3 " rguenth at gcc dot gnu dot org
2008-03-25 10:11 ` rguenth 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).