Patchwork [c++] rewrite vtable initialization construction to use VECs

login
register
mail settings
Submitter Nathan Froyd
Date June 15, 2010, 12:22 p.m.
Message ID <20100615122234.GW27105@codesourcery.com>
Download mbox | patch
Permalink /patch/55645/
State New
Headers show

Comments

Nathan Froyd - June 15, 2010, 12:22 p.m.
On Thu, Jun 10, 2010 at 10:05:58AM -0700, Steve Ellcey wrote:
> Sorry for not replying sooner but I was on vacation.  This change has
> broken the ia64-hp-hpux11.23 build where
> TARGET_VTABLE_DATA_ENTRY_DISTANCE is set.  HP-UX is different then Linux
> because it has a 32 bit mode where the value of this is 2 instead of 1
> and I think that is why it works on Linux but not on HP-UX.
> 
> /proj/opensrc_nobackup/nightly2/src/trunk/libstdc++-v3/libsupc++/exception:61:9: internal compiler error: vector VEC(constructor_elt,base) index domain error, in build_vtbl_initializer at cp/class.c:7629
> Please submit a full bug report,
> with preprocessed source if appropriate.

Ah, whoops, I clearly didn't look closely enough to see what platforms I
should have been testing on.  I think the patch below does the trick.
Could you please try it and report back?

-Nathan
Steve Ellcey - June 15, 2010, 5:30 p.m.
On Tue, 2010-06-15 at 05:22 -0700, Nathan Froyd wrote:

> Ah, whoops, I clearly didn't look closely enough to see what platforms I
> should have been testing on.  I think the patch below does the trick.
> Could you please try it and report back?
> 
> -Nathan
> 
> Index: class.c
> ===================================================================
> --- class.c	(revision 160473)
> +++ class.c	(working copy)
> @@ -7624,7 +7624,7 @@ build_vtbl_initializer (tree binfo,
>  
>  	  for (j = 1; j < TARGET_VTABLE_DATA_ENTRY_DISTANCE; ++j)
>  	    {
> -	      constructor_elt *f = VEC_index (constructor_elt, *inits,
> +	      constructor_elt *f = VEC_index (constructor_elt, vid.inits,
>  					      new_position + j);
>  	      f->index = NULL_TREE;
>  	      f->value = build1 (NOP_EXPR, vtable_entry_type,

Well, the bootstrap worked and I got a compiler built but I get a bunch
of failures during C++ and libstdc++ testing.  Does the attached failure
and backtrace give you any ideas on where the problem might be?

Using libstdc++-v3/testsuite/20_util/allocator/1.cc as an example, the
test compiles but fails during execution in 32 bit mode.  It works in 64
bit mode when TARGET_VTABLE_DATA_ENTRY_DISTANCE is 1.

Steve Ellcey
sje@cup.hp.com

(gdb) r
Starting
program: /proj/opensrc/nightly/build-ia64-hp-hpux11.23-trunk/obj_gcc/ia64-hp-hpux11.23/libstdc++-v3/testsuite/1.exe 

Program received signal SIGSEGV, Segmentation fault
  si_code: 2 - SEGV_ACCERR - Invalid Permissions for object.
0x200000006585b5f0 in __dynamic_cast (src2dst=0)
    at /proj/opensrc/nightly/src/trunk/libstdc++-v3/libsupc
++/dyncast.cc:61
61                                  dst_type, whole_ptr, src_type,
src_ptr, result);



(gdb) bt
#0  0x200000006585b5f0 in __dynamic_cast (src2dst=0)
    at /proj/opensrc/nightly/src/trunk/libstdc++-v3/libsupc
++/dyncast.cc:61
#1  0x20000000657c3120 in bool std::has_facet<std::ctype<char> > ()

from /proj/opensrc/nightly/build-ia64-hp-hpux11.23-trunk/obj_gcc/ia64-hp-hpux11.23/libstdc++-v3/src/.libs/libstdc++.so.6
#2  0x2000000065793ff0 in std::basic_ios<char,std::char_traits<char>
>::_M_cache_locale () at basic_ios.tcc:158
#3  0x2000000065794290 in std::basic_ios<char,std::char_traits<char>
>::init ()
    at basic_ios.tcc:131
#4  0x2000000065764ca0 in std::ios_base::Init::Init (this=0x656afa38)
    at ostream:83
#5  0x40017d0 in __static_initialization_and_destruction_0
(__initialize_p=1, 
    __priority=65535)
#6  0x40018b0 in _GLOBAL__I_check_new ()
#7  0x20000000658a8300:0 in EM_mark_BOS+0x50 ()
from /usr/lib/hpux32/dld.so

Patch

Index: class.c
===================================================================
--- class.c	(revision 160473)
+++ class.c	(working copy)
@@ -7624,7 +7624,7 @@  build_vtbl_initializer (tree binfo,
 
 	  for (j = 1; j < TARGET_VTABLE_DATA_ENTRY_DISTANCE; ++j)
 	    {
-	      constructor_elt *f = VEC_index (constructor_elt, *inits,
+	      constructor_elt *f = VEC_index (constructor_elt, vid.inits,
 					      new_position + j);
 	      f->index = NULL_TREE;
 	      f->value = build1 (NOP_EXPR, vtable_entry_type,