This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/933: new-abi crash with virtual derivation



>Number:         933
>Category:       c++
>Synopsis:       new-abi crash with virtual derivation
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 29 21:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        2.97 20001127 (experimental)
>Organization:
>Environment:
System: Linux karma 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-libstdcxx-v3 --enable-threads=posix --enable-cshadow-headers
>Description:
  The compiler crashes on some complicated inheritance graphs if -fnew-abi
  is used.

>How-To-Repeat:
  Compile the following with -fnew-abi:

-----------------------------------------------------------
class d0_Object
{
public:
  virtual ~d0_Object ();
};


class M10 : virtual public d0_Object {};
class M4  : virtual public M10 {};

class M9
  : public M4, virtual public M10
{
public:
  M9 ();
};

M9::M9 () {}

-----------------------------------------------------------


$ ./cc1plus -fnew-abi -lang-c++ y.cc
 M9::M9() d0_Object::d0_Object() d0_Object::__base_ctor() d0_Object::__comp_ctor() M10::M10() M10::__base_ctor(const void**) M10::__comp_ctor() M10::~M10() M10::~__base_dtor(const void**) M10::~__comp_dtor() M10::~__deleting_dtor() M4::M4() M4::__base_ctor(const void**) M4::__comp_ctor() M4::~M4() M4::~__base_dtor(const void**) M4::~__comp_dtor() M4::~__deleting_dtor() M9::__base_ctor(const void**) M9::__base_ctor(const void**) M9::__comp_ctor() M9::__comp_ctor() void M10::_ZTv0_n12_N3M10D1Ev() void M10::_ZTv0_n16_N3M10D0Ev() void M4::_ZTv0_n12_N2M4D1Ev() void M4::_ZTv0_n16_N2M4D0Ev() void M9::_ZTv0_n12_N2M9D1Ev() void M9::_ZTv0_n16_N2M9D0Ev() M9::~M9() M9::~__base_dtor(const void**) M9::~__comp_dtor() M9::~__comp_dtor()
y.cc:19: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Here's where it's crashing:

Program received signal SIGSEGV, Segmentation fault.
0x8234ef5 in expand_expr (exp=0x401a7fe0, target=0x0, tmode=VOIDmode, 
    modifier=EXPAND_NORMAL) at ../../egcs/gcc/expr.c:7300
7300              else if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST


and the tree here is:

(gdb) call debug_tree (exp)
 <plus_expr 0x401a7fe0
    type <pointer_type 0x40175600
        type <array_type 0x4016f980 type <pointer_type 0x40150280>
            BLK
            size <integer_cst 0x4016a4a0 constant 288>
            unit size <integer_cst 0x4016a4c0 constant 36>
            align 32 symtab 0 alias set -1 domain <integer_type 0x40169a80>
            pointer_to_this <pointer_type 0x40175600>>
        unsigned SI
        size <integer_cst 0x40145f80 constant 32>
        unit size <integer_cst 0x40145fa0 constant 4>
        align 32 symtab 0 alias set -1>
   
    arg 0 <cond_expr 0x401a8000 type <pointer_type 0x40175600>
       
        arg 0 <integer_cst 0x4014cf20 constant 0>
        arg 1 <integer_cst 0x4014c140 constant 0>
        arg 2 <addr_expr 0x401a8020 type <pointer_type 0x40175600>
            readonly constant arg 0 <var_decl 0x4016fa00 _ZTT2M9>>>>


I.e., a plus_expr with only one argument?


I think i found where this tree is being built, in build_new_method_call():

	  sub_vtt = build (PLUS_EXPR, TREE_TYPE (vtt), vtt,
			   BINFO_SUBVTT_INDEX (basetype_path));
	  sub_vtt = build_indirect_ref (sub_vtt, NULL);


At this point, i have:

(gdb) call debug_tree (vtt)
 <cond_expr 0x401a5660
    type <pointer_type 0x40175600
        type <array_type 0x4016f980 type <pointer_type 0x40150280>
            BLK
            size <integer_cst 0x4016a4a0 constant 288>
            unit size <integer_cst 0x4016a4c0 constant 36>
            align 32 symtab 0 alias set -1 domain <integer_type 0x40169a80>
            pointer_to_this <pointer_type 0x40175600>>
        unsigned SI
        size <integer_cst 0x40145f80 constant 32>
        unit size <integer_cst 0x40145fa0 constant 4>
        align 32 symtab 0 alias set -1>
   
    arg 0 <parm_decl 0x4016c880
        type <boolean_type 0x4014e880 bool unsigned type_6 QI
            size <integer_cst 0x40145400 constant 8>
            unit size <integer_cst 0x40145f00 constant 1>
            align 8 symtab 0 alias set -1 precision 1
            min <integer_cst 0x4014cea0 constant 0>
            max <integer_cst 0x4014cee0 constant 1>>
        unsigned QI file y.cc line 16 size <integer_cst 0x40145400 8> unit size <integer_cst 0x40145f00 1>
        align 8 context <function_decl 0x4016c600 M9> initial <boolean_type 0x4014e880 bool>>
    arg 1 <parm_decl 0x4016c800 __vtt_parm
        type <pointer_type 0x40150300 type <pointer_type 0x40150280>
            unsigned SI size <integer_cst 0x40145f80 32> unit size <integer_cst 0x40145fa0 4>
            align 32 symtab 0 alias set -1>
        unsigned SI file y.cc line 16 size <integer_cst 0x40145f80 32> unit size <integer_cst 0x40145fa0 4>
        align 32 context <function_decl 0x4016c600 M9> initial <pointer_type 0x40150300> chain <parm_decl 0x4016c880>>
    arg 2 <addr_expr 0x401a5640 type <pointer_type 0x40175600>
        readonly constant
        arg 0 <var_decl 0x4016fa00 _ZTT2M9 type <array_type 0x4016f980>
            readonly addressable asm_written used public static common virtual BLK file y.cc line 16 size <integer_cst 0x4016a4a0 288> unit size <integer_cst 0x4016a4c0 36>
            align 256 context <record_type 0x40169e80 M9> initial <constructor 0x40173a00>
           
            (mem/s/u:BLK (symbol_ref:SI ("_ZTT2M9")) 0) chain <var_decl 0x4016f780 _ZTC2M90_3M10>>>>


and

(gdb) call debug_tree (basetype_path)
 <tree_vec 0x40167980
    type <record_type 0x40160b00 M10 addressable tree_1 tree_2 tree_3 needs-constructing type_1 type_2 type_4 type_5 BLK
        size <integer_cst 0x40145f80 constant 32>
        unit size <integer_cst 0x40161b20 constant 4>
        align 32 symtab 0 alias set -1
        fields <type_decl 0x40160c80 M10 type <record_type 0x40160b00 M10>
            nonlocal VOID file y.cc line 8
            align 1 context <record_type 0x40160b00 M10>
           >
       needs-constructor needs-destructor ~X() X() X(constX&) this=(X&) n_parents 1 use_template=0 interface-unknown vtable-needs-writing
        member-functions <tree_vec 0x4015f8c0
            elt 0 <overload 0x4015d7d0>
            elt 1 <function_decl 0x40160e00 M10>
            elt 2 <function_decl 0x40162d00 operator=>
            elt 3 <overload 0x4015d850>
            elt 4 <overload 0x4015d820>
            elt 5 <function_decl 0x40163a00 __comp_dtor>
            elt 6 <function_decl 0x40163c00 __base_dtor>
            elt 7 <function_decl 0x40163800 __deleting_dtor>>
        pointer_to_this <pointer_type 0x40160b80> reference_to_this <reference_type 0x40162b00> chain <type_decl 0x40160c00 M10>>
    public static
    elt 0 <tree_vec 0x40167840>
    elt 1 <integer_cst 0x4016d7a0 0>
    elt 2 <plus_expr 0x40165560>
    elt 3 <tree_list 0x40161bc0>

thanks,
sss


>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]