1 http://sourceware.org/ml/gdb-patches/2010-09/msg00321.html
2 Subject: [patch] PR 12028 "GDB crashes on a double free during overload resolution"
4 old_cleanups was being set twice making the later call to
5 discard_cleanups ignore the first 'make_cleanup' request.
7 The patch is proposed for both head and the 7.2 branch.
9 This has been regression tested on x8664 with gcc-4.4.4-10.fc13
12 Fix PR 12028: "GDB crashes on a double free during overload resolution "
14 2010-09-16 Sami Wagiaalla <swagiaal@redhat.com>
17 * valops.c (find_oload_champ_namespace_loop): removed incorrect
18 'old_cleanups' reassignment.
20 2010-09-16 Sami Wagiaalla <swagiaal@redhat.com>
22 * gdb.cp/pr12028.cc: New.
23 * gdb.cp/pr12028.exp: New.
25 diff --git a/gdb/testsuite/gdb.cp/pr12028.cc b/gdb/testsuite/gdb.cp/pr12028.cc
27 index 0000000..0fcab6b
29 +++ b/gdb/testsuite/gdb.cp/pr12028.cc
33 +class C: public B {};
36 + int foo (A) { return 11; }
37 + int foo (C) { return 12; }
52 diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp
54 index 0000000..746c6b5
56 +++ b/gdb/testsuite/gdb.cp/pr12028.exp
58 +# Copyright 2008 Free Software Foundation, Inc.
60 +# This program is free software; you can redistribute it and/or modify
61 +# it under the terms of the GNU General Public License as published by
62 +# the Free Software Foundation; either version 3 of the License, or
63 +# (at your option) any later version.
65 +# This program is distributed in the hope that it will be useful,
66 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
67 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 +# GNU General Public License for more details.
70 +# You should have received a copy of the GNU General Public License
71 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
74 +set srcfile ${testfile}.cc
75 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } {
79 +############################################
81 +if ![runto_main] then {
82 + perror "couldn't run to breakpoint main"
86 +gdb_test "p D::foo(b)" "Cannot resolve function foo to any overloaded instance"
87 diff --git a/gdb/valops.c b/gdb/valops.c
88 index 7fbad10..4e83a04 100644
91 @@ -2715,7 +2715,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
92 function symbol to start off with.) */
94 old_cleanups = make_cleanup (xfree, *oload_syms);
95 - old_cleanups = make_cleanup (xfree, *oload_champ_bv);
96 + make_cleanup (xfree, *oload_champ_bv);
97 new_namespace = alloca (namespace_len + 1);
98 strncpy (new_namespace, qualified_name, namespace_len);
99 new_namespace[namespace_len] = '\0';