public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/40943]  New: Uninitialized warning is missed when dereferencing uninitialized pointers
@ 2009-08-02 19:35 mikulas at artax dot karlin dot mff dot cuni dot cz
  2009-08-02 21:42 ` [Bug middle-end/40943] [4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mikulas at artax dot karlin dot mff dot cuni dot cz @ 2009-08-02 19:35 UTC (permalink / raw)
  To: gcc-bugs

Hi

This is a simple example that should warn about uninitialized variable, but
doesn't. Compile with -O2 -Wall:

void a(void)
{
        int *p1;
        *p1 = 3;
}

gcc-4.3 warned correctly in this case.


-- 
           Summary: Uninitialized warning is missed when dereferencing
                    uninitialized pointers
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
 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=40943


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
@ 2009-08-02 21:42 ` rguenth at gcc dot gnu dot org
  2009-08-03 13:10 ` 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-08-02 21:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-08-02 21:42 -------
Confirmed.  I see no technical reason for this.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |4.4.1 4.5.0
      Known to work|                            |4.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-02 21:42:12
               date|                            |
            Summary|Uninitialized warning is    |[4.4/4.5 Regression]
                   |missed when dereferencing   |Uninitialized warning is
                   |uninitialized pointers      |missed when dereferencing
                   |                            |uninitialized pointers
   Target Milestone|---                         |4.4.2


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
  2009-08-02 21:42 ` [Bug middle-end/40943] [4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
@ 2009-08-03 13:10 ` jakub at gcc dot gnu dot org
  2009-08-03 13:41 ` jakub 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-08-03 13:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2009-08-03 13:10 -------
Broken by Manu's PR179 changes:
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139347


-- 


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
  2009-08-02 21:42 ` [Bug middle-end/40943] [4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
  2009-08-03 13:10 ` jakub at gcc dot gnu dot org
@ 2009-08-03 13:41 ` jakub at gcc dot gnu dot org
  2009-08-03 13:44 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-03 13:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-08-03 13:41 -------
Created an attachment (id=18289)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18289&action=view)
gcc45-pr40943.patch

Untested fix.  It breaks uninit-6*.c again though, but "fixing" this kind of
false positive by simply disabling uninitialized warnings for all pointer
dereferences on LHS is IMHO too big hammer.


-- 


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (2 preceding siblings ...)
  2009-08-03 13:41 ` jakub at gcc dot gnu dot org
@ 2009-08-03 13:44 ` rguenth at gcc dot gnu dot org
  2009-08-03 14:07 ` manu 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-08-03 13:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-08-03 13:44 -------
Since the alias-improvements branch merge uninitialized warnings for aggregates
are seriously broken implementation wise anyway.


-- 


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (3 preceding siblings ...)
  2009-08-03 13:44 ` rguenth at gcc dot gnu dot org
@ 2009-08-03 14:07 ` manu at gcc dot gnu dot org
  2009-08-03 16:23 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-08-03 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2009-08-03 14:07 -------
(In reply to comment #3)
> Created an attachment (id=18289)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18289&action=view) [edit]
> gcc45-pr40943.patch
> 
> Untested fix.  It breaks uninit-6*.c again though, but "fixing" this kind of
> false positive by simply disabling uninitialized warnings for all pointer
> dereferences on LHS is IMHO too big hammer.
> 

I was testing the exactly same patch, you posted first, so the honor is yours.
:-)

Notice that you should not need -O2 for testing this. The testcase should work
even with -O0.

Notice that uninit-6 is a missed optimization. Even with -O2, the unreachable
use of field is still present in the code shown by
uninit-6-O0.c.136t.optimized, so it seems the tree optimizers do not handle
this case. My patch only hide the symptom (the warning) but the missed
optimization was still there so we could xfail it again.


-- 


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (4 preceding siblings ...)
  2009-08-03 14:07 ` manu at gcc dot gnu dot org
@ 2009-08-03 16:23 ` jakub at gcc dot gnu dot org
  2009-08-03 19:26 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-03 16:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-08-02 21:42:12         |2009-08-03 16:22:45
               date|                            |


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (5 preceding siblings ...)
  2009-08-03 16:23 ` jakub at gcc dot gnu dot org
@ 2009-08-03 19:26 ` jakub at gcc dot gnu dot org
  2009-08-03 19:28 ` jakub at gcc dot gnu dot org
  2009-08-03 19:32 ` jakub at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-03 19:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2009-08-03 19:26 -------
Subject: Bug 40943

Author: jakub
Date: Mon Aug  3 19:26:10 2009
New Revision: 150379

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150379
Log:
        PR middle-end/40943
        * tree-ssa.c (warn_uninitialized_var): Even on LHS warn for
        operand of INDIRECT_REF.

        * gcc.dg/uninit-6.c: Re-add XFAIL.
        * gcc.dg/uninit-6-O0.c: Likewise.
        * gcc.dg/uninit-pr40943.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/uninit-pr40943.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/uninit-6-O0.c
    trunk/gcc/testsuite/gcc.dg/uninit-6.c
    trunk/gcc/tree-ssa.c


-- 


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (6 preceding siblings ...)
  2009-08-03 19:26 ` jakub at gcc dot gnu dot org
@ 2009-08-03 19:28 ` jakub at gcc dot gnu dot org
  2009-08-03 19:32 ` jakub at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-03 19:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2009-08-03 19:27 -------
Subject: Bug 40943

Author: jakub
Date: Mon Aug  3 19:27:32 2009
New Revision: 150380

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150380
Log:
        PR middle-end/40943
        * tree-ssa.c (warn_uninitialized_var): Even on LHS warn for
        operand of INDIRECT_REF.

        * gcc.dg/uninit-6.c: Re-add XFAIL.
        * gcc.dg/uninit-6-O0.c: Likewise.
        * gcc.dg/uninit-pr40943.c: New test.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/uninit-pr40943.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/uninit-6-O0.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/uninit-6.c
    branches/gcc-4_4-branch/gcc/tree-ssa.c


-- 


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


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

* [Bug middle-end/40943] [4.4/4.5 Regression] Uninitialized warning is missed when dereferencing uninitialized pointers
  2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (7 preceding siblings ...)
  2009-08-03 19:28 ` jakub at gcc dot gnu dot org
@ 2009-08-03 19:32 ` jakub at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-08-03 19:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2009-08-03 19:32 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-08-03 19:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-02 19:35 [Bug middle-end/40943] New: Uninitialized warning is missed when dereferencing uninitialized pointers mikulas at artax dot karlin dot mff dot cuni dot cz
2009-08-02 21:42 ` [Bug middle-end/40943] [4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
2009-08-03 13:10 ` jakub at gcc dot gnu dot org
2009-08-03 13:41 ` jakub at gcc dot gnu dot org
2009-08-03 13:44 ` rguenth at gcc dot gnu dot org
2009-08-03 14:07 ` manu at gcc dot gnu dot org
2009-08-03 16:23 ` jakub at gcc dot gnu dot org
2009-08-03 19:26 ` jakub at gcc dot gnu dot org
2009-08-03 19:28 ` jakub at gcc dot gnu dot org
2009-08-03 19:32 ` jakub 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).