svn commit: r275477 - head/contrib/gcc/cp
Dimitry Andric
dim at FreeBSD.org
Thu Dec 4 17:26:06 UTC 2014
Author: dim
Date: Thu Dec 4 17:26:04 2014
New Revision: 275477
URL: https://svnweb.freebsd.org/changeset/base/275477
Log:
Pull in r174303 from upstream gcc trunk (by Jason Merrill):
PR c++/48211
* name-lookup.h (cp_class_binding): Make base a pointer.
* name-lookup.c (new_class_binding): Adjust.
(poplevel_class): Adjust.
This fixes a potential segfault when compiling gold, a part of the
devel/binutils port, with gcc. See also the upstream bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48211
Thanks to Jason Merrill, Tom Callaway and Red Hat legal for approving
the use of this patch under the GNU GPL, version 2 or later.
MFC after: 1 week
Modified:
head/contrib/gcc/cp/name-lookup.c
head/contrib/gcc/cp/name-lookup.h
Modified: head/contrib/gcc/cp/name-lookup.c
==============================================================================
--- head/contrib/gcc/cp/name-lookup.c Thu Dec 4 15:57:58 2014 (r275476)
+++ head/contrib/gcc/cp/name-lookup.c Thu Dec 4 17:26:04 2014 (r275477)
@@ -319,35 +319,11 @@ new_class_binding (tree name, tree value
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 (i = 0;
- VEC_iterate (cp_class_binding, scope->class_shadowed, i, cb);
- i++)
- {
- 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;
}
@@ -2501,7 +2477,10 @@ poplevel_class (void)
for (i = 0;
VEC_iterate (cp_class_binding, level->class_shadowed, i, cb);
++i)
- 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;
}
Modified: head/contrib/gcc/cp/name-lookup.h
==============================================================================
--- head/contrib/gcc/cp/name-lookup.h Thu Dec 4 15:57:58 2014 (r275476)
+++ head/contrib/gcc/cp/name-lookup.h Thu Dec 4 17:26:04 2014 (r275477)
@@ -144,7 +144,7 @@ typedef enum tag_scope {
typedef struct cp_class_binding GTY(())
{
- cxx_binding base;
+ cxx_binding *base;
/* The bound name. */
tree identifier;
} cp_class_binding;
More information about the svn-src-all
mailing list