g++ ICE from size stuff (g++ 2.96 20000327 on i686-pc-linux-gnu)

scott snyder snyder@fnal.gov
Mon Mar 27 20:17:00 GMT 2000


hi -

The current cvs version of g++ (2.96 20000327 on i686-pc-linux-gnu)
gets an ICE on the following input:

--------------------------------------------------------------
template <class Key>
class d0_Hashmap
{
public:
  class iterator
  {
  };

  void erase (iterator i);
};

template <class Key>
void d0_Hashmap<Key>::erase (d0_Hashmap::iterator i)
{
}

template class d0_Hashmap<int>;
--------------------------------------------------------------

$ ./cc1plus x.cc
void d0_Hashmap<Key>::erase (d0_Hashmap<Key>::iterator)
x.cc: In method `void d0_Hashmap<Key>::erase
x.cc: (d0_Hashmap<Key>::iterator) [with Key = int]':
x.cc:17:   instantiated from here
x.cc:14: Internal compiler error in `size_binop', at fold-const.c:1910
x.cc:14: Please submit a full bug report.
x.cc:14: See <URL: http://www.gnu.org/software/gcc/bugs.html > for
x.cc:14: instructions.


Here's where it's crashing:

Breakpoint 2, fancy_abort (file=0x826c575 "../../egcs/gcc/fold-const.c", 
    line=1910, function=0x826c66c "size_binop") at ../../egcs/gcc/rtl.c:1247
1247      if (function == NULL)
(gdb) where
#0  fancy_abort (file=0x826c575 "../../egcs/gcc/fold-const.c", line=1910, 
    function=0x826c66c "size_binop") at ../../egcs/gcc/rtl.c:1247
#1  0x805b75d in size_binop (code=CEIL_DIV_EXPR, arg0=0x4010e2e0, 
    arg1=0x400164a0) at ../../egcs/gcc/fold-const.c:1910
#2  0x8058012 in layout_decl (decl=0x40125480, known_align=0)
    at ../../egcs/gcc/stor-layout.c:320
#3  0x820152b in require_complete_types_for_parms (parms=0x40125400)
    at ../../../egcs/gcc/cp/decl.c:11553
#4  0x820352b in check_function_type (decl=0x40122e00)
    at ../../../egcs/gcc/cp/decl.c:13072
#5  0x820398c in start_function (declspecs=0x0, declarator=0x40122e00, 
    attrs=0x0, flags=1) at ../../../egcs/gcc/cp/decl.c:13284
#6  0x8211d50 in instantiate_decl (d=0x40122e00)
    at ../../../egcs/gcc/cp/pt.c:9597
#7  0x8211e99 in instantiate_pending_templates ()
    at ../../../egcs/gcc/cp/pt.c:9680
#8  0x821f50c in finish_file () at ../../../egcs/gcc/cp/decl2.c:3462
#9  0x8231eba in yyparse () at parse.y:434
#10 0x804bb3b in compile_file (name=0x4011b5f0 "x.cc")
    at ../../egcs/gcc/toplev.c:2451
#11 0x804f589 in main (argc=2, argv=0xbffffc44) at ../../egcs/gcc/toplev.c:4935
(gdb) up
#1  0x805b75d in size_binop (code=CEIL_DIV_EXPR, arg0=0x4010e2e0, 
    arg1=0x400164a0) at ../../egcs/gcc/fold-const.c:1910
1910        abort ();
(gdb) list
1905    {
1906      tree type = TREE_TYPE (arg0);
1907
1908      if (TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)
1909          || type != TREE_TYPE (arg1))
1910        abort ();
1911
1912      /* Handle the special case of two integer constants faster.  */
1913      if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
1914        {
(gdb) call debug_tree (arg0)
 <integer_cst 0x4010e2e0 type <integer_type 0x4010c400 int> constant 0>
(gdb) call debug_tree (arg1)
 <integer_cst 0x400164a0 type <integer_type 0x4010d400 bit_size_type> constant 8>


thanks,
sss


More information about the Gcc-bugs mailing list