public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial
@ 2014-09-11 18:38 Siva Chandra
  2014-09-29  8:08 ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Siva Chandra @ 2014-09-11 18:38 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 170 bytes --]

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.

[-- Attachment #2: fix_gnuv3_abi_fix2.txt --]
[-- Type: text/plain, Size: 472 bytes --]

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++)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial
  2014-09-11 18:38 [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial Siva Chandra
@ 2014-09-29  8:08 ` Doug Evans
  2014-09-29 22:29   ` Siva Chandra
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2014-09-29  8:08 UTC (permalink / raw)
  To: Siva Chandra; +Cc: gdb-patches

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial
  2014-09-29  8:08 ` Doug Evans
@ 2014-09-29 22:29   ` Siva Chandra
  2014-10-14 21:01     ` Doug Evans
  0 siblings, 1 reply; 5+ messages in thread
From: Siva Chandra @ 2014-09-29 22:29 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial
  2014-09-29 22:29   ` Siva Chandra
@ 2014-10-14 21:01     ` Doug Evans
  2014-10-15  1:10       ` Siva Chandra
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2014-10-14 21:01 UTC (permalink / raw)
  To: Siva Chandra; +Cc: gdb-patches

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;
+

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial
  2014-10-14 21:01     ` Doug Evans
@ 2014-10-15  1:10       ` Siva Chandra
  0 siblings, 0 replies; 5+ messages in thread
From: Siva Chandra @ 2014-10-15  1:10 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-15  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 18:38 [PATCH 4/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to treat dynamic classes as non-trivial Siva Chandra
2014-09-29  8:08 ` Doug Evans
2014-09-29 22:29   ` Siva Chandra
2014-10-14 21:01     ` Doug Evans
2014-10-15  1:10       ` Siva Chandra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).