public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17494] New: Ternary operator not evaluated correctly
@ 2014-10-20 13:35 sivachandra at gmail dot com
  2014-10-20 13:36 ` [Bug c++/17494] " sivachandra at gmail dot com
  2014-11-04  2:06 ` cvs-commit at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: sivachandra at gmail dot com @ 2014-10-20 13:35 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 17494
           Summary: Ternary operator not evaluated correctly
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: sivachandra at gmail dot com

Consider the following code:

class A
{
public:
  A () { a = 12345; }
  int geta ();

  int a;
};

int
A::geta ()
{
  return a;
}

int
main ()
{
  A a;
  return 0;  /* Break here  */
}

I see this with GDB:

(gdb) p a.geta()
$3 = 12345
(gdb) p false ? a.geta() : 123
$2 = {a = 12345}

The result is of the wrong type (and value).

Similarly:

(gdb) p (true ? 123 : a.geta()) + 1
Can't do that binary op on that type

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


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

* [Bug c++/17494] Ternary operator not evaluated correctly
  2014-10-20 13:35 [Bug c++/17494] New: Ternary operator not evaluated correctly sivachandra at gmail dot com
@ 2014-10-20 13:36 ` sivachandra at gmail dot com
  2014-11-04  2:06 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: sivachandra at gmail dot com @ 2014-10-20 13:36 UTC (permalink / raw)
  To: gdb-prs

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

Siva Chandra <sivachandra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sivachandra at gmail dot com
           Assignee|unassigned at sourceware dot org   |sivachandra at google dot com

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


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

* [Bug c++/17494] Ternary operator not evaluated correctly
  2014-10-20 13:35 [Bug c++/17494] New: Ternary operator not evaluated correctly sivachandra at gmail dot com
  2014-10-20 13:36 ` [Bug c++/17494] " sivachandra at gmail dot com
@ 2014-11-04  2:06 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-11-04  2:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  e0f52461c2467b6610391681fa27cd9b3c5def57 (commit)
      from  f868b157aa4079bcdcb482b6b6634b5df8f74dbd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e0f52461c2467b6610391681fa27cd9b3c5def57

commit e0f52461c2467b6610391681fa27cd9b3c5def57
Author: Siva Chandra <sivachandra@chromium.org>
Date:   Sat Oct 18 06:14:00 2014 -0700

    Fix evaluation of method calls under EVAL_SKIP.

    When evaluating method calls under EVAL_SKIP, the "object" and the
    arguments to the method should also be evaluated under EVAL_SKIP,
    instead of skipping to evaluate them as was being done previously.

    gdb/ChangeLog:

        PR c++/17494
        * eval.c (evaluate_subexp_standard): Evaluate the "object" and
        the method args also under EVAL_SKIP when evaluating method
        calls under EVAL_SKIP.

    gdb/testsuite/ChangeLog:

        PR c++/17494
        * gdb.cp/pr17494.cc: New file.
        * gdb.cp/pr17494.exp: New file.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog                    |    7 ++++
 gdb/eval.c                       |   13 ++++---
 gdb/testsuite/ChangeLog          |    6 +++
 gdb/testsuite/gdb.cp/pr17494.cc  |   63 ++++++++++++++++++++++++++++++++++++++
 gdb/testsuite/gdb.cp/pr17494.exp |   57 ++++++++++++++++++++++++++++++++++
 5 files changed, 140 insertions(+), 6 deletions(-)
 create mode 100644 gdb/testsuite/gdb.cp/pr17494.cc
 create mode 100644 gdb/testsuite/gdb.cp/pr17494.exp

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


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

end of thread, other threads:[~2014-11-04  2:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-20 13:35 [Bug c++/17494] New: Ternary operator not evaluated correctly sivachandra at gmail dot com
2014-10-20 13:36 ` [Bug c++/17494] " sivachandra at gmail dot com
2014-11-04  2:06 ` cvs-commit at gcc dot gnu.org

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