This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/18165] incorrect evaluation of copy constructor on return statement


https://sourceware.org/bugzilla/show_bug.cgi?id=18165

Siva Chandra <sivachandra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sivachandra at gmail dot com

--- Comment #2 from Siva Chandra <sivachandra at gmail dot com> ---
I think the commit that makes you see it as a regression is this:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=82c48ac732edb0155288a93ef3dd39625ff2d2e1

What was happening before 7.9 is explained in the commit message. In your
example, there is the 'const' qualifier to the copy constructor argument.
Versions before 7.9 would not have treated that as a copy constructor and would
have used a calling convention suitable for trivial return values. Now, that
calling convention is correct for your example because the copy constructor is
declared 'default'. However, the older versions of GDB concluded that the class
was trivial by accident.

As far as I know, clang or gcc do not emit any sort of debug info to convey to
a debugger that the copy constructor has been 'default'ed. The 7.9 version sees
a user declared copy constructor, but does not know about it being declared
'default', and hence wrongly concludes that the class is non-trivial. It
consequently uses the calling convention suitable for non-trivial return values
and gives the wrong result.

As an experiment, you could try removing the 'const' qualifier to the copy
constructor arg with older versions of GDB. Their behavior should be similar to
the 7.9 behavior.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]