From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23913 invoked by alias); 17 Sep 2010 14:42:46 -0000 Received: (qmail 23905 invoked by uid 22791); 17 Sep 2010 14:42:45 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 17 Sep 2010 14:42:40 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8HEgdwG002666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Sep 2010 10:42:39 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8HEgcJh030517 for ; Fri, 17 Sep 2010 10:42:38 -0400 Received: from [10.15.16.129] (dhcp-10-15-16-129.yyz.redhat.com [10.15.16.129]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o8HEgcHk005138 for ; Fri, 17 Sep 2010 10:42:38 -0400 Message-ID: <4C937E2D.80500@redhat.com> Date: Sat, 18 Sep 2010 09:25:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] PR 12028 "GDB crashes on a double free during overload resolution" Content-Type: multipart/mixed; boundary="------------090205020905080005000608" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00324.txt.bz2 This is a multi-part message in MIME format. --------------090205020905080005000608 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 245 old_cleanups was being set twice making the later call to discard_cleanups ignore the first 'make_cleanup' request. The patch is proposed for both head and the 7.2 branch. This has been regression tested on x8664 with gcc-4.4.4-10.fc13 Sami --------------090205020905080005000608 Content-Type: text/x-patch; name="pr12028.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr12028.patch" Content-length: 2582 Fix PR 12028: "GDB crashes on a double free during overload resolution " 2010-09-16 Sami Wagiaalla PR C++/12028 * valops.c (find_oload_champ_namespace_loop): removed incorrect 'old_cleanups' reassignment. 2010-09-16 Sami Wagiaalla * gdb.cp/pr12028.cc: New. * gdb.cp/pr12028.exp: New. diff --git a/gdb/testsuite/gdb.cp/pr12028.cc b/gdb/testsuite/gdb.cp/pr12028.cc new file mode 100644 index 0000000..0fcab6b --- /dev/null +++ b/gdb/testsuite/gdb.cp/pr12028.cc @@ -0,0 +1,21 @@ +class A{}; +class B{}; +class C: public B {}; + +namespace D{ + int foo (A) { return 11; } + int foo (C) { return 12; } +} + +int main() +{ + A a; + B b; + C c; + + D::foo (a); + // D::foo (b); + D::foo (c); + + return 0; +} diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp new file mode 100644 index 0000000..746c6b5 --- /dev/null +++ b/gdb/testsuite/gdb.cp/pr12028.exp @@ -0,0 +1,29 @@ +# Copyright 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set testfile pr12028 +set srcfile ${testfile}.cc +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } { + return -1 +} + +############################################ + +if ![runto_main] then { + perror "couldn't run to breakpoint main" + continue +} + +gdb_test "p D::foo(b)" "Cannot resolve function foo to any overloaded instance" diff --git a/gdb/valops.c b/gdb/valops.c index 7fbad10..4e83a04 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2715,7 +2715,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs, function symbol to start off with.) */ old_cleanups = make_cleanup (xfree, *oload_syms); - old_cleanups = make_cleanup (xfree, *oload_champ_bv); + make_cleanup (xfree, *oload_champ_bv); new_namespace = alloca (namespace_len + 1); strncpy (new_namespace, qualified_name, namespace_len); new_namespace[namespace_len] = '\0'; --------------090205020905080005000608--