From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78418 invoked by alias); 19 Apr 2015 21:30:02 -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 78348 invoked by uid 48); 19 Apr 2015 21:29:58 -0000 From: "vries at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65802] [6 Regression] ICE in redirect_eh_edge_1, at tree-eh.c:2335 Date: Sun, 19 Apr 2015 21:30: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: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries 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: 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: 2015-04/txt/msg01565.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65802 --- Comment #4 from vries at gcc dot gnu.org --- The assert triggering is: ... (gdb) #5 0x00000000011325fe in redirect_eh_edge_1 (edge_in=0x7ffff64af4d0, new_bb=0x7ffff64ae4e0, change_region=true) at src/gcc/tree-eh.c:2335 2335 gcc_assert (lookup_stmt_eh_lp (throw_stmt) == old_lp_nr); ... Indeed the comparison fails: ... (gdb) p old_lp_nr $1 = 1 (gdb) p lookup_stmt_eh_lp (throw_stmt) $2 = 0 ... And lookup_stmt_eh_lp (throw_stmt) is 0, because throw_stmt is NULL, which presumably is not intended to be NULL here: ... (gdb) p throw_stmt $3 = (gimple) 0x0 ... throw_stmt is initialized here: ... 2334 throw_stmt = last_stmt (edge_in->src); ... In fact edge_in->src is an empty bb: ... (gdb) call debug_bb (edge_in->src) ;; basic block 15, loop depth 0, count 0, freq 0, maybe hot ;; prev block 14, next block 3, flags: (NEW) ;; pred: 14 (FALLTHRU) ;; succ: 7 (EH) ;; 3 (FALLTHRU) ... Before pass_lower_vaarg, we have this definition in bb2 definining for _6: ... ;; basic block 2, loop depth 0, count 0, freq 0, maybe hot ;; prev block 0, next block 3, flags: (NEW, REACHABLE) ;; pred: ENTRY (FALLTHRU) [LP 1] # .MEM_5 = VDEF <.MEM_4(D)> # USE = anything # CLB = anything _6 = VA_ARG (&cD.2333, 0B); ;; succ: 7 (EH) ;; 3 (FALLTHRU) ... After pass_lower_vaarg, it's spread over several basic blocks: ... ;; basic block 2, loop depth 0, count 0, freq 0, maybe hot ;; prev block 0, next block 11, flags: (NEW, REACHABLE) ;; pred: ENTRY (FALLTHRU) ;; succ: 11 [100.0%] (FALLTHRU) ;; basic block 11, loop depth 0, count 0, freq 0, maybe hot ;; prev block 2, next block 12, flags: (NEW) ;; pred: 2 [100.0%] (FALLTHRU) # VUSE <.MEM_4(D)> _22 = cD.2333.gp_offsetD.5; if (_22 >= 48) goto (); else goto (); ;; succ: 13 (TRUE_VALUE) ;; 12 (FALSE_VALUE) ;; basic block 12, loop depth 0, count 0, freq 0, maybe hot ;; prev block 11, next block 13, flags: (NEW) ;; pred: 11 (FALSE_VALUE) : # VUSE <.MEM_4(D)> _23 = cD.2333.reg_save_areaD.8; # VUSE <.MEM_4(D)> _24 = cD.2333.gp_offsetD.5; _25 = (sizetype) _24; addr.1_26 = _23 + _25; # VUSE <.MEM_4(D)> _27 = cD.2333.gp_offsetD.5; _28 = _27 + 8; # .MEM_29 = VDEF <.MEM_4(D)> cD.2333.gp_offsetD.5 = _28; goto (); ;; succ: 14 (FALLTHRU) ;; basic block 13, loop depth 0, count 0, freq 0, maybe hot ;; prev block 12, next block 14, flags: (NEW) ;; pred: 11 (TRUE_VALUE) : # VUSE <.MEM_4(D)> _30 = cD.2333.overflow_arg_areaD.7; addr.1_31 = _30; _32 = _30 + 8; # .MEM_33 = VDEF <.MEM_4(D)> cD.2333.overflow_arg_areaD.7 = _32; ;; succ: 14 (FALLTHRU) ;; basic block 14, loop depth 0, count 0, freq 0, maybe hot ;; prev block 13, next block 15, flags: (NEW) ;; pred: 12 (FALLTHRU) ;; 13 (FALLTHRU) # .MEM_20 = PHI <.MEM_29(12), .MEM_33(13)> # addr.1_21 = PHI : # VUSE <.MEM_20> _6 = MEM[(intD.9 * * {ref-all})addr.1_21]; ;; succ: 15 (FALLTHRU) ;; basic block 15, loop depth 0, count 0, freq 0, maybe hot ;; prev block 14, next block 3, flags: (NEW) ;; pred: 14 (FALLTHRU) ;; succ: 7 (EH) ;; 3 (FALLTHRU) ... Before the expansion, the ifn_va_arg is the statement that could throw: ... (gdb) call debug_bb_n (2) ;; basic block 2, loop depth 0, count 0, freq 0, maybe hot ;; prev block 0, next block 3, flags: (NEW, REACHABLE) ;; pred: ENTRY (FALLTHRU) [LP 1] # .MEM_5 = VDEF <.MEM_4(D)> # USE = anything # CLB = anything _6 = VA_ARG (&cD.2333, 0B); ;; succ: 7 (EH) ;; 3 (FALLTHRU) $1 = (basic_block_def *) 0x7ffff64ae270 (gdb) call stmt_could_throw_p ( last_stmt ($1 ) ) $3 = true ... But the last statement before bb15 cannot throw: ... (gdb) call debug_bb_n (14) ;; basic block 14, loop depth 0, count 0, freq 0, maybe hot ;; prev block 13, next block 15, flags: (NEW) ;; pred: 12 (FALLTHRU) ;; 13 (FALLTHRU) # .MEM_20 = PHI <.MEM_29(12), .MEM_33(13)> # addr.1_21 = PHI : # VUSE <.MEM_20> _6 = MEM[(intD.9 * * {ref-all})addr.1_21]; ;; succ: 15 (FALLTHRU) $4 = (basic_block_def *) 0x7ffff64aea90 (gdb) call stmt_could_throw_p ( last_stmt ($4 ) ) $5 = false ... So it does not seem to be just a question of removing the last empty bb.