From owner-svn-src-stable-7@FreeBSD.ORG Thu Dec 11 08:06:03 2014 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3667D535; Thu, 11 Dec 2014 08:06:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F9616AC39; Thu, 11 Dec 2014 08:06:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBB8620B049265; Thu, 11 Dec 2014 08:06:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBB8628V049260; Thu, 11 Dec 2014 08:06:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201412110806.sBB8628V049260@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 11 Dec 2014 08:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r275699 - in stable: 10/contrib/gcc/cp 7/contrib/gcc/cp 8/contrib/gcc/cp 9/contrib/gcc/cp X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2014 08:06:03 -0000 Author: dim Date: Thu Dec 11 08:05:59 2014 New Revision: 275699 URL: https://svnweb.freebsd.org/changeset/base/275699 Log: MFC r275477: 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. Modified: stable/7/contrib/gcc/cp/name-lookup.c stable/7/contrib/gcc/cp/name-lookup.h Directory Properties: stable/7/contrib/gcc/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gcc/cp/name-lookup.c stable/10/contrib/gcc/cp/name-lookup.h stable/8/contrib/gcc/cp/name-lookup.c stable/8/contrib/gcc/cp/name-lookup.h stable/9/contrib/gcc/cp/name-lookup.c stable/9/contrib/gcc/cp/name-lookup.h Directory Properties: stable/10/ (props changed) stable/8/contrib/gcc/ (props changed) stable/9/contrib/gcc/ (props changed) Modified: stable/7/contrib/gcc/cp/name-lookup.c ============================================================================== --- stable/7/contrib/gcc/cp/name-lookup.c Thu Dec 11 06:52:10 2014 (r275698) +++ stable/7/contrib/gcc/cp/name-lookup.c Thu Dec 11 08:05:59 2014 (r275699) @@ -302,35 +302,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; } @@ -2447,7 +2423,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: stable/7/contrib/gcc/cp/name-lookup.h ============================================================================== --- stable/7/contrib/gcc/cp/name-lookup.h Thu Dec 11 06:52:10 2014 (r275698) +++ stable/7/contrib/gcc/cp/name-lookup.h Thu Dec 11 08:05:59 2014 (r275699) @@ -142,7 +142,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;