[4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial
Message ID | CAGyQ6gwUDdJh+oUxJxhgSXfY90cp2hkh-+mN0wEcJp90naBXog@mail.gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 20762 invoked by alias); 11 Sep 2014 18:38:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 20752 invoked by uid 89); 11 Sep 2014 18:38:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f180.google.com Received: from mail-ob0-f180.google.com (HELO mail-ob0-f180.google.com) (209.85.214.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 11 Sep 2014 18:38:15 +0000 Received: by mail-ob0-f180.google.com with SMTP id wp4so2098116obc.39 for <gdb-patches@sourceware.org>; Thu, 11 Sep 2014 11:38:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=jiqz95UJNBj/ba6x9qNdCJmiIHs9mqap50Om9E0serI=; b=QC+8qRu+iVpVzUVHMTNiPBbfUgDNoCZhor+RhRK4ac4Dv5UPbG7FgLZFR9dGFTbIgC hnt0QD6H88MAGGv8F2PmzjGKOozUCDVfZvXZ5nl+ZWW0sR+40g2Eh5gxx5qFY5kcl1Al tFfGvzRor1aVbEjCIF7fWgklEAZmFHSOP0Z19mA1aPijNbPaZs+bpiVjm5dyX+2wV4JQ JCZRJj8FfmRwt6lrgmPZp6coQbtIyuzXLbyy819tOHoDneZZIuGHZ0DtA/rix2qy+/yk QoEUq70OoE+SwOcjYe5CtVUi+bLpso1MQ9dKjdqg1jT4S7SM/QgoamklO4fpbSilxI/Y IF0g== X-Gm-Message-State: ALoCoQnry9MW2S3LwrlFuY24Y8zuaQZZ7R2vPs+TaflrzSfbGaVtcKPdR9T7+n9xKkVLZmCGcvcw MIME-Version: 1.0 X-Received: by 10.60.65.35 with SMTP id u3mr3137034oes.35.1410460693696; Thu, 11 Sep 2014 11:38:13 -0700 (PDT) Received: by 10.202.225.135 with HTTP; Thu, 11 Sep 2014 11:38:13 -0700 (PDT) Date: Thu, 11 Sep 2014 11:38:13 -0700 Message-ID: <CAGyQ6gwUDdJh+oUxJxhgSXfY90cp2hkh-+mN0wEcJp90naBXog@mail.gmail.com> Subject: [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial From: Siva Chandra <sivachandra@google.com> To: gdb-patches <gdb-patches@sourceware.org> Content-Type: multipart/mixed; boundary=001a11c257589e4b030502ce781f X-IsSubscribed: yes |
Commit Message
Siva Chandra Reddy
Sept. 11, 2014, 6:38 p.m. UTC
gdb/ChangeLog: 2014-09-11 Siva Chandra Reddy <sivachandra@google.com> * gnu-v3-abi.c (gnuv3_pass_by_reference): Treat dynamic classes as non-trivial.
Comments
On Thu, Sep 11, 2014 at 11:38 AM, Siva Chandra <sivachandra@google.com> wrote: > gdb/ChangeLog: > > 2014-09-11 Siva Chandra Reddy <sivachandra@google.com> > > * gnu-v3-abi.c (gnuv3_pass_by_reference): Treat dynamic classes > as non-trivial. This looks ok to me. I couldn't find anything in the ABI to guide me (could certainly have missed it), though it seems reasonable and it does fix the testcase.
On Mon, Sep 29, 2014 at 1:08 AM, Doug Evans <dje@google.com> wrote: >> 2014-09-11 Siva Chandra Reddy <sivachandra@google.com> >> >> * gnu-v3-abi.c (gnuv3_pass_by_reference): Treat dynamic classes >> as non-trivial. > > This looks ok to me. > I couldn't find anything in the ABI to guide me (could certainly have > missed it), though it seems reasonable and it does fix the testcase. The ABI defers the definition of triviality of copy constructors and destructors to the C++ 98 final draft standard. The point under question in this patch is under -6- here: http://www.kouzdra.org/page/docs/isocpp/special.html#class.copy
Siva Chandra writes: > On Mon, Sep 29, 2014 at 1:08 AM, Doug Evans <dje@google.com> wrote: > >> 2014-09-11 Siva Chandra Reddy <sivachandra@google.com> > >> > >> * gnu-v3-abi.c (gnuv3_pass_by_reference): Treat dynamic classes > >> as non-trivial. > > > > This looks ok to me. > > I couldn't find anything in the ABI to guide me (could certainly have > > missed it), though it seems reasonable and it does fix the testcase. > > The ABI defers the definition of triviality of copy constructors and > destructors to the C++ 98 final draft standard. The point under > question in this patch is under -6- here: > http://www.kouzdra.org/page/docs/isocpp/special.html#class.copy Ah. Thanks for the reference. LGTM with one nit. It'd be really nice to include a reference to the spec here. I don't know about others, but this stuff is not the kind of thing I tend to keep in cache, and when reading such code it's really nice to be able to find the relevant sections of the spec without any effort. Does the following make sense? + /* A dynamic class has a non-trivial copy constructor. + See c++98 section 12.8 Copying class objects [class.copy]. */ + if (gnuv3_dynamic_class (type)) + return 1; +
On Tue, Oct 14, 2014 at 2:01 PM, Doug Evans <dje@google.com> wrote: > It'd be really nice to include a reference to the spec here. > I don't know about others, but this stuff is not the kind of > thing I tend to keep in cache, and when reading such code > it's really nice to be able to find the relevant sections > of the spec without any effort. > > Does the following make sense? > > + /* A dynamic class has a non-trivial copy constructor. > + See c++98 section 12.8 Copying class objects [class.copy]. */ > + if (gnuv3_dynamic_class (type)) > + return 1; > + Thanks Doug. I will push this patch set after adding the above comment.
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index a79a6a9..5ce2fb5 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1282,6 +1282,9 @@ gnuv3_pass_by_reference (struct type *type) && TYPE_CODE (type) != TYPE_CODE_UNION) return 0; + if (gnuv3_dynamic_class (type)) + return 1; + for (fieldnum = 0; fieldnum < TYPE_NFN_FIELDS (type); fieldnum++) for (fieldelem = 0; fieldelem < TYPE_FN_FIELDLIST_LENGTH (type, fieldnum); fieldelem++)