public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amker.cheng at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/49498] [4.7/4.8 Regression]: gcc.dg/uninit-pred-8_b.c bogus warning line 20 Date: Tue, 20 Nov 2012 07:09:00 -0000 [thread overview] Message-ID: <bug-49498-4-CFCz3deBNL@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-49498-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49498 bin.cheng <amker.cheng at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amker.cheng at gmail dot | |com --- Comment #17 from bin.cheng <amker.cheng at gmail dot com> 2012-11-20 07:08:18 UTC --- Hi, I spent some time analyzing this bug and I think I understand the problem now. For below dump file from trunk/cris-elf when compiling the attached k.c: ;; Function foo (foo, funcdef_no=0, decl_uid=1323, cgraph_uid=0) ;; 1 loops found ;; ;; Loop 0 ;; header 0, latch 1 ;; depth 0, outer -1 ;; nodes: 0 1 2 3 4 5 6 7 8 9 10 11 ;; 2 succs { 10 3 } ;; 3 succs { 11 4 } ;; 4 succs { 11 } ;; 5 succs { 6 7 } ;; 6 succs { 9 } ;; 7 succs { 6 8 } ;; 8 succs { 9 } ;; 9 succs { 1 } ;; 10 succs { 5 6 } ;; 11 succs { 5 8 } foo (int n, int l, int m, int r) { int v; int g.1; int g.0; <bb 2>: if (n_4(D) <= 9) goto <bb 10>; else goto <bb 3>; <bb 3>: if (m_5(D) > 100) goto <bb 11>; else goto <bb 4>; <bb 4>: goto <bb 11>; <bb 5>: # v_14 = PHI <v_13(11), r_7(D)(10)> g.0_9 = g; g.1_10 = g.0_9 + 1; g = g.1_10; if (n_4(D) <= 9) goto <bb 6>; else goto <bb 7>; <bb 6>: # v_17 = PHI <v_14(5), v_14(7), r_7(D)(10)> blah (v_17); goto <bb 9>; <bb 7>: if (m_5(D) > 100) goto <bb 6>; else goto <bb 8>; <bb 8>: <bb 9>: return 0; <bb 10>: if (m_5(D) != 0) goto <bb 5>; else goto <bb 6>; <bb 11>: # v_13 = PHI <r_7(D)(3), v_6(D)(4)> if (m_5(D) != 0) goto <bb 5>; else goto <bb 8>; } There are two flaws in tree-ssa-uninit.c revealing this bug. 1. GCC try to find def_chains from cd_root(which is the closest dominating bb for phi_bb) to phi_bb, but only find use_predicates from phi_bb to use_bb. In general case with canonical CFG, this is fine, but in non-canonical CFG, it's possible to have ancestor basic block of phi_bb in def_chains which have branch that never reach to phi_bb, like basic block 10 reported in this PR. In this scenario the corresponding condition should not be counted in def_chains(edge<10, 5> in this case). There are two methods to fix this: a) find use predicates from dom(phi_bb), rather than phi_bb in non-canonical CFGs. b) prune branch conditions that are irrelevant to this use/def in def_chains. Method a is simpler, but the problem is it results in more dep_chains which might exceeds the limit MAX_NUM_CHAINS. As for method b), I haven't got any clue to implement it. 2. When calling is_use_properly_guarded in find_uninit_use, GCC finds predicates from source basic block if the use_stmt is a phi node. This results in missing condition at the end of each def_chain. Different from the first issue, this can be easily fixed.
next prev parent reply other threads:[~2012-11-20 7:09 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-22 0:03 [Bug regression/49498] New: [4.7 " hp at gcc dot gnu.org 2011-06-22 3:08 ` [Bug regression/49498] " hp at gcc dot gnu.org 2011-06-22 9:16 ` rguenth at gcc dot gnu.org 2011-06-22 17:28 ` law at redhat dot com 2011-06-30 19:43 ` law at redhat dot com 2011-06-30 20:38 ` xinliangli at gmail dot com 2011-07-05 16:05 ` law at redhat dot com 2011-07-05 16:07 ` law at redhat dot com 2011-07-05 22:53 ` xinliangli at gmail dot com 2011-07-07 16:23 ` law at redhat dot com 2011-07-07 19:32 ` xinliangli at gmail dot com 2011-07-07 21:27 ` law at redhat dot com 2011-07-07 21:52 ` hp at gcc dot gnu.org 2011-07-11 15:29 ` law at redhat dot com 2011-10-15 17:11 ` ktietz at gcc dot gnu.org 2012-03-22 8:49 ` [Bug tree-optimization/49498] [4.7/4.8 " rguenth at gcc dot gnu.org 2012-06-14 8:25 ` rguenth at gcc dot gnu.org 2012-09-20 10:28 ` jakub at gcc dot gnu.org 2012-11-20 7:09 ` amker.cheng at gmail dot com [this message] 2012-11-21 13:08 ` pinskia at gcc dot gnu.org 2012-11-21 13:24 ` amker.cheng at gmail dot com 2013-04-11 7:59 ` [Bug tree-optimization/49498] [4.7/4.8/4.9 " rguenth at gcc dot gnu.org 2014-06-12 13:47 ` [Bug tree-optimization/49498] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org 2014-12-19 13:32 ` [Bug tree-optimization/49498] [4.8/4.9/5 " jakub at gcc dot gnu.org 2015-06-23 8:24 ` [Bug tree-optimization/49498] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org 2015-06-26 20:00 ` [Bug tree-optimization/49498] [4.9/5/6 " jakub at gcc dot gnu.org 2015-06-26 20:30 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-49498-4-CFCz3deBNL@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).