diff options
author | Jason Merrill <jason@redhat.com> | 2011-05-26 14:30:13 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-05-26 14:30:13 -0400 |
commit | f256f612d49c99e153a024b2cf759537959dad29 (patch) | |
tree | 035a507f1fed8939853b6cb55fe1d1ca83c8921e /gcc/cp | |
parent | aed5574e7b576594b71bbda5c822c667055b791c (diff) | |
download | gcc-f256f612d49c99e153a024b2cf759537959dad29.zip gcc-f256f612d49c99e153a024b2cf759537959dad29.tar.gz gcc-f256f612d49c99e153a024b2cf759537959dad29.tar.bz2 |
re PR c++/48211 ([C++0x] Segment Fault When Compiling)
PR c++/48211
* name-lookup.h (cp_class_binding): Make base a pointer.
* name-lookup.c (new_class_binding): Adjust.
(poplevel_class): Adjust.
From-SVN: r174303
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 29 | ||||
-rw-r--r-- | gcc/cp/name-lookup.h | 2 |
3 files changed, 11 insertions, 25 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8e9b25f..4835d84 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2011-05-26 Jason Merrill <jason@redhat.com> + PR c++/48211 + * name-lookup.h (cp_class_binding): Make base a pointer. + * name-lookup.c (new_class_binding): Adjust. + (poplevel_class): Adjust. + PR c++/48424 * decl.c (grokparms): Function parameter packs don't need to go at the end. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index bb6d4b9..935dd2a 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -319,33 +319,11 @@ new_class_binding (tree name, tree value, tree type, cxx_scope *scope) cp_class_binding *cb; cxx_binding *binding; - if (VEC_length (cp_class_binding, scope->class_shadowed)) - { - cp_class_binding *old_base; - old_base = VEC_index (cp_class_binding, scope->class_shadowed, 0); - if (VEC_reserve (cp_class_binding, gc, scope->class_shadowed, 1)) - { - /* Fixup the current bindings, as they might have moved. */ - size_t i; - - FOR_EACH_VEC_ELT (cp_class_binding, scope->class_shadowed, i, cb) - { - cxx_binding **b; - b = &IDENTIFIER_BINDING (cb->identifier); - while (*b != &old_base[i].base) - b = &((*b)->previous); - *b = &cb->base; - } - } - cb = VEC_quick_push (cp_class_binding, scope->class_shadowed, NULL); - } - else cb = VEC_safe_push (cp_class_binding, gc, scope->class_shadowed, NULL); cb->identifier = name; - binding = &cb->base; + cb->base = binding = cxx_binding_make (value, type); binding->scope = scope; - cxx_binding_init (binding, value, type); return binding; } @@ -2725,7 +2703,10 @@ poplevel_class (void) if (level->class_shadowed) { FOR_EACH_VEC_ELT (cp_class_binding, level->class_shadowed, i, cb) - IDENTIFIER_BINDING (cb->identifier) = cb->base.previous; + { + IDENTIFIER_BINDING (cb->identifier) = cb->base->previous; + cxx_binding_free (cb->base); + } ggc_free (level->class_shadowed); level->class_shadowed = NULL; } diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index 4bf253f..3309f0a 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -140,7 +140,7 @@ typedef enum tag_scope { } tag_scope; typedef struct GTY(()) cp_class_binding { - cxx_binding base; + cxx_binding *base; /* The bound name. */ tree identifier; } cp_class_binding; |