From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23135 invoked by alias); 8 May 2014 16:27:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23096 invoked by uid 48); 8 May 2014 16:27:51 -0000 From: "patrick at parcs dot ath.cx" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/61112] Simple example triggers false-positive -Wmaybe-uninitialized warning Date: Thu, 08 May 2014 16:27: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: normal X-Bugzilla-Who: patrick at parcs dot ath.cx 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: Message-ID: In-Reply-To: References: 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: 2014-05/txt/msg00699.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61112 --- Comment #2 from patrick at parcs dot ath.cx --- Relevant contents of -fdump-tree-uninit: [WORKLIST]: Update worklist with phi: w_2 = PHI [CHECK]: examining phi: w_2 = PHI [CHECK] Found def edge 1 in w_1 = PHI [CHECK] Found def edge 1 in w_2 = PHI [AFTER NORMALIZATION -- [USE]: p = w_2; is guarded by : y_7(D) != 0 (.OR.) x_4(D) != 0 [AFTER NORMALIZATION -- [DEF]: w_2 = PHI is guarded by : y_7(D) != 0 [CHECK]: Found unguarded use: p = w_2; void void foo(int, int, int) (int x, int y, int z) { int w; int _8; : if (x_4(D) != 0) goto ; else goto ; : goto ; : : # w_1 = PHI if (y_7(D) != 0) goto ; else goto ; : goto ; : : # w_2 = PHI _8 = x_4(D) | y_7(D); if (_8 != 0) goto ; else goto ; : goto ; : p = w_2; : return; } uninit analysis correctly detects two defining edges but one of the edges (src=bb 9, dest=bb 4) flows into the control dependence root (bb 6). Since this edge can not be reached downwards from the CD root, it is not considered when reconstructing the predicate chain that guards the definition of w_2. As a result, an incomplete def predicate chain is computed and a warning is emitted. If instead the control dependence root was bb 2 then the aforementioned edge would not get discarded (because the edge could be reached from bb 2) and so the computed def predicate chain would be complete. I have a patch that fixes this issue.