Bug 15159 - [3.4 regression] ICE in rtl_verify_flow_info_1
Summary: [3.4 regression] ICE in rtl_verify_flow_info_1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.4.0
: P2 critical
Target Milestone: 3.4.1
Assignee: rsandifo@gcc.gnu.org
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-04-26 23:31 UTC by Wolfgang Bangerth
Modified: 2004-06-21 06:34 UTC (History)
5 users (show)

See Also:
Host: mips-sgi-irix6.5
Target: mips-sgi-irix6.5
Build: mips-sgi-irix6.5
Known to work: 3.3.3
Known to fail: 3.4.0
Last reconfirmed: 2004-04-27 17:27:29


Attachments
preprocessed sources (95.44 KB, text/plain)
2004-04-26 23:33 UTC, Wolfgang Bangerth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2004-04-26 23:31:08 UTC
The attached testcase compiles fine with gcc 3.3, but ICEs with 
gcc 3.4 like so: 
 
deal.II/lac> c++ -c -O2 block_sparse_matrix.ii 
block_sparse_matrix.ii: In member function `void 
BlockSparseMatrix<number>::reinit(const BlockSparsityPattern&) [with number = 
double]': 
block_sparse_matrix.ii:34301: error: in basic block 35: 
block_sparse_matrix.ii:34301: error: flow control insn inside a basic block 
(call_insn 746 672 751 35 (call_placeholder 711 673 0 0 (call_insn 713 712 714 
(parallel [ 
                (set (reg:SI 2 $2) 
                    (call (mem:SI (reg:SI 321) [0 S4 A32]) 
                        (const_int 0 [0x0]))) 
                (clobber (reg:SI 31 $31)) 
            ]) -1 (nil) 
        (nil) 
        (expr_list (use (reg:SI 28 $28)) 
            (expr_list (use (reg:SI 4 $4)) 
                (nil))))) -1 (nil) 
    (nil) 
    (nil)) 
block_sparse_matrix.ii:34301: internal compiler error: in 
rtl_verify_flow_info_1, at cfgrtl.c:2053 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
Since this machine is just about too slow, I will not be able to 
provide reduced code for a while. If someone has an interest in 
beating me to it, please feel more than welcome! 
 
W.
Comment 1 Wolfgang Bangerth 2004-04-26 23:33:35 UTC
Created attachment 6166 [details]
preprocessed sources
Comment 2 Wolfgang Bangerth 2004-04-26 23:50:06 UTC
I should note that I could trigger this ICE on three different files 
(two of them had the same kind of loop, the third one didn't; the 
common theme was the access to a previously assigned reference), 
so it doesn't seem to be a really rare thing. 
 
Who is the author of rtl_verify_flow_info_1? 
 
W. 
Comment 3 Andrew Pinski 2004-04-26 23:56:09 UTC
rtl_verify_flow_info_1 came about with this patch but it was split out from rtl_verify_flow_info so it most 
likely not a bug in rtl_verify_flow_info_1 or rtl_verify_flow_info but a bug in the RTL optimizers, this is a 
verifier which verifiers if the RTL is wrong.

Sun Jun  8 15:52:17 CEST 2003  Jan Hubicka  <jh@suse.cz>

        * i386.md (subsi_3_zext, sse2_nandv2di3): Fix predicates.
        * i386.c (k8_avoid_jump_misspredicts): Fix debug output.

        * cfg.c (verify_flow_info): Move IL independent checks from cfgrtl here.
        (dump_bb): New based on old dump_bb in cfgrtl.c
        (debug_bb, debug_bb_n): Move the functions from cfgrtl.c here.
        * cfghooks.h (cfgh_verify_flow_info): Return status.
        * cfglayout.c (cfg_layout_finalize): Verify CFG correctness.
        * cfgrtl.c (debug_bb, debug_bb_n): Move to cfg.c
        (dump_bb): Remove generic parts.
        (rtl_verify_flow_info_1): Break out from rtl_verify_flow_info.
        (rtl_verify_flow_info): Only check things dependeing on linearized RTL.
Comment 4 Wolfgang Bangerth 2004-04-27 00:23:54 UTC
Jan, does this ICE trigger something with you? 
W. 
Comment 5 Wolfgang Bangerth 2004-04-27 14:27:55 UTC
Here is a small testcase: 
-------------------------- 
struct S { 
    S (); 
    void reinit (); 
}; 
 
struct P { 
    P & operator= (S *); 
    S * operator -> () const; 
}; 
 
class X { 
    void reinit (); 
    P p; 
}; 
 
void X::reinit () 
{ 
 p = new S(); 
 p->reinit (); 
} 
----------------------------- 
 
bangerth/tmp> /home/staff/bangerth/bin/sgi/gcc-3.4.0/bin/c++ -O2 -c x.cc 
x.cc: In member function `void X::reinit()': 
x.cc:20: error: in basic block 0: 
x.cc:20: error: flow control insn inside a basic block 
(call_insn 86 6 90 0 (call_placeholder 51 13 0 0 (call_insn 53 52 54 (parallel [ 
                (set (reg:SI 2 $2) 
                    (call (mem:SI (reg:SI 193) [0 S4 A32]) 
                        (const_int 0 [0x0]))) 
                (clobber (reg:SI 31 $31)) 
            ]) -1 (nil) 
        (nil) 
        (expr_list (use (reg:SI 28 $28)) 
            (expr_list (use (reg:SI 4 $4)) 
                (nil))))) -1 (nil) 
    (nil) 
    (nil)) 
x.cc:20: internal compiler error: in rtl_verify_flow_info_1, at cfgrtl.c:2053 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
bangerth/tmp> /home/staff/bangerth/bin/sgi/gcc-3.4.0/bin/c++ -v 
Reading specs from /home/staff/bangerth/bin/sgi/gcc-3.4.0/lib/gcc/mips-sgi-irix6.5/3.4.0/specs 
Configured with: ../gcc-3.4.0/configure --prefix=/home/staff/bangerth/bin/sgi/gcc-3.4.0 
--enable-languages=c,c++,f77 --enable-checking 
Thread model: single 
gcc version 3.4.0 
 
W. 
Comment 6 Wolfgang Bangerth 2004-04-27 14:33:37 UTC
Uh, this goes even smaller: 
---------------------- 
struct S { 
    S (); 
    void foo (); 
}; 
 
struct P { 
    P (S *); 
    S s; 
}; 
 
void bar () { 
 P p = new S(); 
 p.s.foo (); 
} 
---------------------------- 
bangerth/tmp> /home/staff/bangerth/bin/sgi/gcc-3.4.0/bin/c++ -O2 -c x.cc 
x.cc: In function `void bar()': 
x.cc:14: error: in basic block 0: 
x.cc:14: error: flow control insn inside a basic block 
(call_insn 85 104 98 0 (call_placeholder 50 12 0 0 (call_insn 52 51 53 (parallel [ 
                (set (reg:SI 2 $2) 
                    (call (mem:SI (reg:SI 194) [0 S4 A32]) 
                        (const_int 0 [0x0]))) 
                (clobber (reg:SI 31 $31)) 
            ]) -1 (nil) 
        (nil) 
        (expr_list (use (reg:SI 28 $28)) 
            (expr_list (use (reg:SI 4 $4)) 
                (nil))))) -1 (nil) 
    (nil) 
    (nil)) 
x.cc:14: internal compiler error: in rtl_verify_flow_info_1, at cfgrtl.c:2053 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
W. 
Comment 7 Volker Reichelt 2004-04-27 17:27:29 UTC
Confirmed (example in comment #6).
Comment 8 rsandifo@gcc.gnu.org 2004-05-01 20:14:33 UTC
Been looking at this a little today.  It seems to be specific to sibling
calls (there's no problem if you use -fno-optimize-sibling-calls) and
probably depends on how aggressively the backend tries to use them.
MIPS is very aggressive ;)

Taking the reduced example:

void bar () { 
  P p = new S(); 
  p.s.foo (); 
}

the first statement ends up in a call_placeholder.  The call inside the
placeholder can throw, so it (correctly?) satisfies control_flow_insn_p.
It is initially placed in its own basic block.

However, reachable_handlers returns an empty list for call_placeholders,
so there are no EH edges from this block.  The only edge is a fallthru
to the second block.  This convinces try_optimize_cfg that the blocks
can be merged by merge_blocks_move().

I'm not sure when I'll next have time to look at this, but maybe the
above will be enough to trigger an Aha!
Comment 9 rsandifo@gcc.gnu.org 2004-06-19 09:17:17 UTC
Think I finally have a handle on this.  Testing a patch now.
Comment 10 rsandifo@gcc.gnu.org 2004-06-20 11:00:46 UTC
Patch posted here:

   http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01601.html

(Mark, this is a somewhat target-independent 3.4.0 ICE-on-valid regression.)
Comment 11 Mark Mitchell 2004-06-21 06:14:26 UTC
Subject: Re:  [3.4 regression] ICE in rtl_verify_flow_info_1

rsandifo at gcc dot gnu dot org wrote:

> ------- Additional Comments From rsandifo at gcc dot gnu dot org  2004-06-20 11:00 -------
> Patch posted here:
> 
>    http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01601.html
> 
> (Mark, this is a somewhat target-independent 3.4.0 ICE-on-valid regression.)

This is OK for 3.4.1; please check in ASAP.

Thanks,

Comment 13 rsandifo@gcc.gnu.org 2004-06-21 06:34:21 UTC
Patch applied to 3.4 branch.  Not a problem on mainline:
see gcc-patches link.