aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2018-09-17 13:11:07 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2018-09-17 13:11:07 -0400
commit461464f22632163209937ba5128d1f9f32554ea3 (patch)
treeaedb5efa545c00cbab381b348794437ce92b0c67 /gdb
parent04e2a1829ea137ac23ac96e98fd60f9d720dcdcb (diff)
downloadgdb-461464f22632163209937ba5128d1f9f32554ea3.zip
gdb-461464f22632163209937ba5128d1f9f32554ea3.tar.gz
gdb-461464f22632163209937ba5128d1f9f32554ea3.tar.bz2
Fix use-after-move in compile/compile-cplus-types.c
Patch d82b3862f12 ("compile: Remove non-const reference parameters") introduced a regression in compile/compile-cplus-types.c. The new_scope variable in compile_cplus_instance::enter_scope is used after it was std::moved. This patch fixes it by referring to the back of the vector where it was moved instead. gdb/ChangeLog: * compile/compile-cplus-types.c (compile_cplus_instance::enter_scope): Don't use new_scope after std::move.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/compile/compile-cplus-types.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 673d35b..419bffd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-09-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * compile/compile-cplus-types.c
+ (compile_cplus_instance::enter_scope): Don't use new_scope after
+ std::move.
+
2018-09-17 Tom Tromey <tom@tromey.com>
* common/pathstuff.c (get_standard_cache_dir): Use
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 75193d2..996fea5 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -261,7 +261,7 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope)
if (debug_compile_cplus_scopes)
{
fprintf_unfiltered (gdb_stdlog, "entering new scope %s\n",
- host_address_to_string (&new_scope));
+ host_address_to_string (&m_scopes.back ()));
}
/* Push the global namespace. */
@@ -270,7 +270,7 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope)
/* Push all other namespaces. Note that we do not push the last
scope_component -- that's the actual type we are converting. */
std::for_each
- (new_scope.begin (), new_scope.end () - 1,
+ (m_scopes.back ().begin (), m_scopes.back ().end () - 1,
[this] (const scope_component &comp)
{
gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol))