]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix cp_binding_level reuse logic
authorPatrick Palka <ppalka@gcc.gnu.org>
Fri, 29 Jan 2016 01:51:03 +0000 (01:51 +0000)
committerPatrick Palka <ppalka@gcc.gnu.org>
Fri, 29 Jan 2016 01:51:03 +0000 (01:51 +0000)
gcc/cp/ChangeLog:

* name-lookup.c (begin_scope): After reusing a cp_binding_level
structure, update free_binding_level before the structure's
level_chain field gets cleared, not after.

From-SVN: r232965

gcc/cp/ChangeLog
gcc/cp/name-lookup.c

index 83a25f707789f8ce0442af50e91536d5cd0fdc21..2c2cdfb0d0cf7466a9287f455231aba1dc455337 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-29  Patrick Palka  <ppalka@gcc.gnu.org>
+
+       * name-lookup.c (begin_scope): After reusing a cp_binding_level
+       structure, update free_binding_level before the structure's
+       level_chain field gets cleared, not after.
+
 2016-01-28  Jason Merrill  <jason@redhat.com>
 
        PR c++/67407
index c52d236c649bb13b7d717316f46236e0d105ed35..92d99aa53d3db118d74f6572152e99e18b82a81a 100644 (file)
@@ -1557,8 +1557,8 @@ begin_scope (scope_kind kind, tree entity)
   if (!ENABLE_SCOPE_CHECKING && free_binding_level)
     {
       scope = free_binding_level;
-      memset (scope, 0, sizeof (cp_binding_level));
       free_binding_level = scope->level_chain;
+      memset (scope, 0, sizeof (cp_binding_level));
     }
   else
     scope = ggc_cleared_alloc<cp_binding_level> ();