public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships
@ 2013-11-21  2:42 vincent-gcc at vinc17 dot net
  2013-11-21  3:29 ` [Bug middle-end/59223] " manu at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2013-11-21  2:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59223
           Summary: -Wmaybe-uninitialized and -Wuninitialized
                    relationships
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net

With:
* gcc-4.8 (Debian 4.8.2-5) 4.8.2
* gcc (Debian 20131021-1) 4.9.0 20131021 (experimental) [trunk revision 203899]

It seems that -Wmaybe-uninitialized works only if -Wuninitialized is enabled.
Moreover -Wmaybe-uninitialized is enabled by -Wuninitialized. I wonder whether
this is intended or something is missing in the man page (the gcc 4.8.2 one
doesn't say anything about these relationships).

xvii:~> cat tst2.c
int foo (int x)
{
  int y;
  if (x == 0)
    y = 1;
  else if (x == 1)
    y = 2;
  return y;
}

First test:

xvii:~> gcc-snapshot -O2 -Wmaybe-uninitialized -c tst2.c

No warning here; -Wuninitialized is needed to trigger the
[-Wmaybe-uninitialized] warning (see below).

Second test:

xvii:~> gcc-snapshot -O2 -Wuninitialized -c tst2.c
tst2.c: In function 'foo':
tst2.c:8:3: warning: 'y' may be used uninitialized in this function
[-Wmaybe-uninitialized]
   return y;
   ^

The use of -Wuninitialized alone has enabled -Wmaybe-uninitialized.


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

* [Bug middle-end/59223] -Wmaybe-uninitialized and -Wuninitialized relationships
  2013-11-21  2:42 [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships vincent-gcc at vinc17 dot net
@ 2013-11-21  3:29 ` manu at gcc dot gnu.org
  2014-02-26 17:55 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2013-11-21  3:29 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I am pretty sure that this is an oversight when the option got renamed. In
particular, this seems appropriate:

Index: tree-ssa-uninit.c
===================================================================
--- tree-ssa-uninit.c    (revision 205089)
+++ tree-ssa-uninit.c    (working copy)
@@ -2175,7 +2175,7 @@
 static bool
 gate_warn_uninitialized (void)
 {
-  return warn_uninitialized != 0;
+  return warn_uninitialized || warn_maybe_uninitialized;
 }



since the pass can warn for both options and the warnings are already guarded
by the appropriate OPT_W* code.
>From gcc-bugs-return-435309-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 03:32:03 2013
Return-Path: <gcc-bugs-return-435309-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29951 invoked by alias); 21 Nov 2013 03:32:02 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29863 invoked by uid 48); 21 Nov 2013 03:31:57 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/19430] V_MAY_DEF (taking address of var) causes missing uninitialized warning
Date: Thu, 21 Nov 2013 03:32:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 3.4.2
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-19430-4-6F4CSCyLI0@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-19430-4@http.gcc.gnu.org/bugzilla/>
References: <bug-19430-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02086.txt.bz2
Content-length: 317

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

--- Comment #19 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Vincent Lefèvre from comment #18)
> This seems to be fixed in the trunk.

Is there an XPASS for gcc.dg/uninit-pr19430.c ?

Also, the testcase from bug 42079?
>From gcc-bugs-return-435310-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 03:43:59 2013
Return-Path: <gcc-bugs-return-435310-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7208 invoked by alias); 21 Nov 2013 03:43:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7002 invoked by uid 48); 21 Nov 2013 03:43:54 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/59225] missing maybe uninitialized warning following single if
Date: Thu, 21 Nov 2013 03:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cc resolution
Message-ID: <bug-59225-4-KUzazzdAze@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59225-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59225-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02087.txt.bz2
Content-length: 991

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
CCP assumes y == 1 in the first testcase, this is PR18501

In the second testcase, y may be either 1 or 2, so CCP does not kick-in, and 
nothing removes the undefined operand of the PHI node:

  # RANGE [1, 2] NONZERO 0x00000000000000003   
  # y_1 = PHI <[test2.c : 5:7] 1(6), y_3(D)(4), [test2.c : 7:7] 2(7)>
  [test2.c : 8:3] # VUSE <.MEM_4(D)>
  return y_1;

so we can warn.

*** This bug has been marked as a duplicate of bug 18501 ***
>From gcc-bugs-return-435311-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 03:44:51 2013
Return-Path: <gcc-bugs-return-435311-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8491 invoked by alias); 21 Nov 2013 03:44:50 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7204 invoked by uid 48); 21 Nov 2013 03:43:58 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/18501] [4.7/4.8/4.9 Regression] Missing 'used uninitialized' warning (CCP)
Date: Thu, 21 Nov 2013 03:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.0.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P5
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-18501-4-vUnyzf3q2t@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-18501-4@http.gcc.gnu.org/bugzilla/>
References: <bug-18501-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02088.txt.bz2
Content-length: 203

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

--- Comment #67 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
*** Bug 59225 has been marked as a duplicate of this bug. ***
>From gcc-bugs-return-435312-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 03:56:03 2013
Return-Path: <gcc-bugs-return-435312-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16465 invoked by alias); 21 Nov 2013 03:56:03 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 16351 invoked by uid 48); 21 Nov 2013 03:56:00 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/18501] [4.7/4.8/4.9 Regression] Missing 'used uninitialized' warning (CCP)
Date: Thu, 21 Nov 2013 03:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.0.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P5
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-18501-4-mbNEyar1K6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-18501-4@http.gcc.gnu.org/bugzilla/>
References: <bug-18501-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02089.txt.bz2
Content-length: 731

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

--- Comment #68 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #67)
> *** Bug 59225 has been marked as a duplicate of this bug. ***

PR 59225 gave me an idea. Wouldn't it be possible to keep a PHI node with just
two operands, the constant and the undefined value? If further optimizations
remove the undefined block as unexecutable, then the undefined operand will go
away. Perhaps the problem is that other optimizations do not treat PHI<1,(D)>
as simply 1 and this will result in worse code, although VRP seems to work just
fine with PHI<1,2,(D)>.

Richard, do you see it feasible?
>From gcc-bugs-return-435313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 04:22:20 2013
Return-Path: <gcc-bugs-return-435313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30340 invoked by alias); 21 Nov 2013 04:22:19 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 30259 invoked by uid 48); 21 Nov 2013 04:22:13 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/19430] V_MAY_DEF (taking address of var) causes missing uninitialized warning
Date: Thu, 21 Nov 2013 04:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 3.4.2
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-19430-4-FrLQj5IC29@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-19430-4@http.gcc.gnu.org/bugzilla/>
References: <bug-19430-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02090.txt.bz2
Content-length: 1064

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

--- Comment #20 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #19)
> (In reply to Vincent Lefèvre from comment #18)
> > This seems to be fixed in the trunk.
> 
> Is there an XPASS for gcc.dg/uninit-pr19430.c ?
> 
> Also, the testcase from bug 42079?

Clang warns for this in the FE without any optimization:

gcc.dg/uninit-pr19430.c:10:7: warning: variable 'j' is used uninitialized
whenever 'if' condition is false [-Wsometimes-uninitialized]
  if (bar (i)) { 
      ^~~~~~~
gcc.dg/uninit-pr19430.c:15:10: note: uninitialized use occurs here
  return j;
         ^
gcc.dg/uninit-pr19430.c:10:3: note: remove the 'if' if its condition is always
true
  if (bar (i)) { 
  ^~~~~~~~~~~~~
gcc.dg/uninit-pr19430.c:8:8: note: initialize the variable 'j' to silence this
warning
  int j; /* { dg-warning "'j' may be used uninitialized in this function"
"uninitialized" { xfail *-*-* } 8 } */
       ^
        = 0
>From gcc-bugs-return-435314-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 04:39:10 2013
Return-Path: <gcc-bugs-return-435314-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4313 invoked by alias); 21 Nov 2013 04:39:09 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 4240 invoked by uid 48); 21 Nov 2013 04:39:06 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/19430] V_MAY_DEF (taking address of var) causes missing uninitialized warning
Date: Thu, 21 Nov 2013 04:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 3.4.2
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-19430-4-nRz6YndF5A@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-19430-4@http.gcc.gnu.org/bugzilla/>
References: <bug-19430-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02091.txt.bz2
Content-length: 2239

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

--- Comment #21 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
$ ~/test1/205036M/build/gcc/cc1 -O1  -Wuninitialized  test.c
-fdump-tree-all-all-lineno
$ cat test.c.139t.uninit1

foo (intD.6 iD.1789)
{
  intD.6 jD.1792;
  intD.6 _5;
  intD.6 _7;

;;   basic block 2, loop depth 0, count 0, freq 10000, maybe hot
;;    prev block 0, next block 5, flags: (NEW, REACHABLE)
;;    pred:       ENTRY [100.0%]  (FALLTHRU,EXECUTABLE)
;;   starting at line 10
  [test.c : 10:11] # .MEM_4 = VDEF <.MEM_2(D)>
  # USE = nonlocal { D.1792 } (escaped)
  # CLB = nonlocal { D.1792 } (escaped)
  _5 = barD.1786 (i_3(D));
  [test.c : 10:6] if (_5 != 0)
    goto <bb 3>;
  else
    goto <bb 5>;
;;    succ:       3 [39.0%]  (TRUE_VALUE,EXECUTABLE)
;;                5 [61.0%]  (FALSE_VALUE,EXECUTABLE)

;;   basic block 5, loop depth 0, count 0, freq 6102, maybe hot
;;    prev block 2, next block 3, flags: (NEW)
;;    pred:       2 [61.0%]  (FALSE_VALUE,EXECUTABLE)
;;
  goto <bb 4>;
;;    succ:       4 [100.0%]  (FALLTHRU)

;;   basic block 3, loop depth 0, count 0, freq 3898, maybe hot
;;    prev block 5, next block 4, flags: (NEW, REACHABLE)
;;    pred:       2 [39.0%]  (TRUE_VALUE,EXECUTABLE)
;;   starting at line 11
  [test.c : 11:9] # .MEM_6 = VDEF <.MEM_4>
  # USE = nonlocal { D.1792 } (escaped)
  # CLB = nonlocal { D.1792 } (escaped)
  bazD.1788 ([test.c : 11] &jD.1792);
;;    succ:       4 [100.0%]  (FALLTHRU,EXECUTABLE)

;;   basic block 4, loop depth 0, count 0, freq 10000, maybe hot
;;    prev block 3, next block 1, flags: (NEW, REACHABLE)
;;    pred:       5 [100.0%]  (FALLTHRU)
;;                3 [100.0%]  (FALLTHRU,EXECUTABLE)
;;   starting at line 14
  # .MEM_1 = PHI <.MEM_4(5), .MEM_6(3)>
  [test.c : 14:3] # VUSE <.MEM_1>
  _7 = jD.1792;
  # .MEM_8 = VDEF <.MEM_1>
  jD.1792 ={v} {CLOBBER};
  [test.c : 14:3] # VUSE <.MEM_8>
  return _7;
;;    succ:       EXIT [100.0%]

}

It seems one could follow every operand of the MEM_1 PHI node until you find
the MEM_4 = VDEF <.MEM_2(D)>. But perhaps this may produce a lot of false
positives.

The uninit pass avoids virtual operands on purpose, so it cannot be that
trivial.
>From gcc-bugs-return-435315-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 06:34:23 2013
Return-Path: <gcc-bugs-return-435315-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21938 invoked by alias); 21 Nov 2013 06:34:22 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 21915 invoked by uid 48); 21 Nov 2013 06:34:17 -0000
From: "octoploid at yandex dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/59226] New: [4.9 Regression] ICE: in record_target_from_binfo, at ipa-devirt.c:661
Date: Thu, 21 Nov 2013 06:34:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: octoploid at yandex dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-59226-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02092.txt.bz2
Content-length: 2096

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

            Bug ID: 59226
           Summary: [4.9 Regression] ICE: in record_target_from_binfo, at
                    ipa-devirt.c:661
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: octoploid at yandex dot com

More outfall from r205019:

markus@x4 tmp % cat test.ii
class A {
  virtual void m_fn1();
};
class B;
class C : A {
public:
  virtual B *m_fn2();
};
class D : virtual C, A {};
class B {
public:
  int m_fn1();
};
class F : virtual public C {};
class G : F, D {
  virtual void m_fn6();
};
F *a;
int b = a->m_fn2()->m_fn1();
G c;

markus@x4 tmp % g++ -c -O2 test.ii
test.ii:9:7: warning: direct base ‘A’ inaccessible in ‘D’ due to ambiguity
[enabled by default]
 class D : virtual C, A {};
       ^
test.ii:20:4: internal compiler error: in record_target_from_binfo, at
ipa-devirt.c:661
 G c;
    ^
0x9bad92 record_target_from_binfo
        ../../gcc/gcc/ipa-devirt.c:661
0x9bab0b record_target_from_binfo
        ../../gcc/gcc/ipa-devirt.c:681
0x9bab0b record_target_from_binfo
        ../../gcc/gcc/ipa-devirt.c:681
0x9baf30 possible_polymorphic_call_targets_1
        ../../gcc/gcc/ipa-devirt.c:705
0x9baf84 possible_polymorphic_call_targets_1
        ../../gcc/gcc/ipa-devirt.c:711
0x9bd7a2 possible_polymorphic_call_targets(tree_node*, long,
ipa_polymorphic_call_context, bool*, void**)
        ../../gcc/gcc/ipa-devirt.c:1292
0x9e2145 possible_polymorphic_call_targets
        ../../gcc/gcc/ipa-utils.h:114
0x9e2145 walk_polymorphic_call_targets
        ../../gcc/gcc/ipa.c:175
0x9e2145 symtab_remove_unreachable_nodes(bool, _IO_FILE*)
        ../../gcc/gcc/ipa.c:398
0xa8a9b7 execute_todo
        ../../gcc/gcc/passes.c:1884
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
>From gcc-bugs-return-435316-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 21 07:51:59 2013
Return-Path: <gcc-bugs-return-435316-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31270 invoked by alias); 21 Nov 2013 07:51:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 31108 invoked by uid 48); 21 Nov 2013 07:51:53 -0000
From: "Joost.VandeVondele at mat dot ethz.ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/59215] tsan: warning in shared_ptr_base.h
Date: Thu, 21 Nov 2013 07:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: Joost.VandeVondele at mat dot ethz.ch
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-59215-4-WghSCNTXPc@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59215-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59215-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02093.txt.bz2
Content-length: 1430

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY215

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Joost.VandeVondele at mat dot ethz
                   |                            |.ch

--- Comment #14 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
(In reply to Jonathan Wakely from comment #10)
> No, you're right, that's a different issue.  I think we've just been relying
> on loads of (correctly-aligned) _Atomic_word being atomic, although that's
> not going to keep tsan happy!  There's no barrier on the read, but I think
> the worst that will happen is we won't see the correct value and the CAS
> loop will go round again. We won't see __count==0 spuriously, because once
> that count reaches zero it never gets incremented again.

Interestingly, a very similar comment was made yesterday in the context of
libgomp: http://gcc.gnu.org/bugzilla/show_bug.cgi?idY194#c4

If for performance reasons a plain load would nevertheless be preferred over an
atomic one, I wonder if these threading libraries could e.g. use conditional
compilation such that, when compiled with -fsanitize=thread, an atomic load is
used nevertheless. Does -fsanitize=thread define a __SANITIZE_THREAD_IN_USE or
similar ?


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

* [Bug middle-end/59223] -Wmaybe-uninitialized and -Wuninitialized relationships
  2013-11-21  2:42 [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships vincent-gcc at vinc17 dot net
  2013-11-21  3:29 ` [Bug middle-end/59223] " manu at gcc dot gnu.org
@ 2014-02-26 17:55 ` mpolacek at gcc dot gnu.org
  2014-02-26 17:56 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-26 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gmail dot com

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 60294 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/59223] -Wmaybe-uninitialized and -Wuninitialized relationships
  2013-11-21  2:42 [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships vincent-gcc at vinc17 dot net
  2013-11-21  3:29 ` [Bug middle-end/59223] " manu at gcc dot gnu.org
  2014-02-26 17:55 ` mpolacek at gcc dot gnu.org
@ 2014-02-26 17:56 ` mpolacek at gcc dot gnu.org
  2014-02-27  8:05 ` mpolacek at gcc dot gnu.org
  2014-02-27  8:07 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-26 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-02-26
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'll post a patch.


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

* [Bug middle-end/59223] -Wmaybe-uninitialized and -Wuninitialized relationships
  2013-11-21  2:42 [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships vincent-gcc at vinc17 dot net
                   ` (2 preceding siblings ...)
  2014-02-26 17:56 ` mpolacek at gcc dot gnu.org
@ 2014-02-27  8:05 ` mpolacek at gcc dot gnu.org
  2014-02-27  8:07 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-27  8:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu Feb 27 08:05:21 2014
New Revision: 208196

URL: http://gcc.gnu.org/viewcvs?rev=208196&root=gcc&view=rev
Log:
    PR middle-end/59223
    * tree-ssa-uninit.c (gate_warn_uninitialized): Run the pass even for
    -Wmaybe-uninitialized.
testsuite/
    * c-c++-common/pr59223.c: New test.


Added:
    trunk/gcc/testsuite/c-c++-common/pr59223.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-uninit.c


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

* [Bug middle-end/59223] -Wmaybe-uninitialized and -Wuninitialized relationships
  2013-11-21  2:42 [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships vincent-gcc at vinc17 dot net
                   ` (3 preceding siblings ...)
  2014-02-27  8:05 ` mpolacek at gcc dot gnu.org
@ 2014-02-27  8:07 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-27  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-02-27  8:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-21  2:42 [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships vincent-gcc at vinc17 dot net
2013-11-21  3:29 ` [Bug middle-end/59223] " manu at gcc dot gnu.org
2014-02-26 17:55 ` mpolacek at gcc dot gnu.org
2014-02-26 17:56 ` mpolacek at gcc dot gnu.org
2014-02-27  8:05 ` mpolacek at gcc dot gnu.org
2014-02-27  8:07 ` mpolacek at gcc dot gnu.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).