From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11575 invoked by alias); 4 Dec 2009 02:21:18 -0000 Received: (qmail 11551 invoked by uid 22791); 4 Dec 2009 02:21:17 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS 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, 04 Dec 2009 02:21:11 +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 nB42L93f004400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 3 Dec 2009 21:21:09 -0500 Received: from [IPv6:::1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB42L6Gl006095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 3 Dec 2009 21:21:09 -0500 Message-ID: <4B187211.8070004@redhat.com> Date: Fri, 04 Dec 2009 02:21:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [RFA] "Sort" C++ fieldlists Content-Type: multipart/mixed; boundary="------------010802040203020708030201" 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: 2009-12/txt/msg00041.txt.bz2 This is a multi-part message in MIME format. --------------010802040203020708030201 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1065 Hi, My method overload resolution patch was committed with the following comment (from value_struct_elt_for_reference): /* This assumes, of course, that all artificial methods appear BEFORE any concrete methods. */ Turns out that isn't a really great assumption. In particular, it fails on GCC 3.4.6. So I'm requesting that the attached patch be approved. The patch inserts artificial methods into the type's fieldlist starting at index 0 and concrete methods starting at the end index. This shows no regressions (and no advantages) using GCC on linux. However, if you run cpexprs.exp, this patch will fix 17 failures with GCC 3.4.6. At the worst, consider this a defensive patch against breaking the value_struct_elt_for_reference assumption. Keith ChangeLog 2009-12-03 Keith Seitz * dwarf2read.c (dwarf2_attach_fn_fields_to_type): Ensure that artificial methods are inserted into the fn fieldlist before concrete methods. * valops.c (value_struct_elt_for_reference): Update comments concerning above assumption. --------------010802040203020708030201 Content-Type: text/plain; name="sort-methods.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sort-methods.patch" Content-length: 1935 Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.342 diff -u -p -r1.342 dwarf2read.c --- dwarf2read.c 2 Dec 2009 11:44:35 -0000 1.342 +++ dwarf2read.c 4 Dec 2009 01:55:11 -0000 @@ -4845,14 +4845,24 @@ dwarf2_attach_fn_fields_to_type (struct { struct nextfnfield *nfp = flp->head; struct fn_fieldlist *fn_flp = &TYPE_FN_FIELDLIST (type, i); - int k; + int k, start, end; TYPE_FN_FIELDLIST_NAME (type, i) = flp->name; TYPE_FN_FIELDLIST_LENGTH (type, i) = flp->length; fn_flp->fn_fields = (struct fn_field *) TYPE_ALLOC (type, sizeof (struct fn_field) * flp->length); + + /* To ease symbol searching, we must require that all artificial + methods appear before any concrete methods in the fieldlist. + See value_struct_elt_for_reference for where this requirement + is needed/used. */ + start = 0; + end = flp->length - 1; for (k = flp->length; (k--, nfp); nfp = nfp->next) - fn_flp->fn_fields[k] = nfp->fnfield; + { + int idx = (nfp->fnfield.is_artificial) ? start++ : end--; + fn_flp->fn_fields[idx] = nfp->fnfield; + } total_length += flp->length; } Index: valops.c =================================================================== RCS file: /cvs/src/src/gdb/valops.c,v retrieving revision 1.228 diff -u -p -r1.228 valops.c --- valops.c 2 Dec 2009 19:29:42 -0000 1.228 +++ valops.c 4 Dec 2009 01:55:12 -0000 @@ -2721,7 +2721,8 @@ value_struct_elt_for_reference (struct t error (_("non-unique member `%s' requires type instantiation"), name); /* This assumes, of course, that all artificial methods appear - BEFORE any concrete methods. */ + BEFORE any concrete methods. This requirement is enforced + for DWARF by dwarf2_attach_fn_fields_to_type. */ j = TYPE_FN_FIELDLIST_LENGTH (t, i) - 1; } --------------010802040203020708030201--