Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Doug Evans" <dje@google.com>
To: "Joel Brobecker" <brobecker@adacore.com>
Cc: "GDB Patches" <gdb-patches@sourceware.org>,
	        "Pierre Muller" <muller@ics.u-strasbg.fr>
Subject: Re: [BUG] BINOP_DIV and ptyp command
Date: Tue, 29 Jan 2008 15:51:00 -0000	[thread overview]
Message-ID: <e394668d0801290748y54ffd52fn4a5f5f66cc71d865@mail.gmail.com> (raw)
In-Reply-To: <20080129064148.GB16288@adacore.com>

On Jan 28, 2008 10:41 PM, Joel Brobecker <brobecker@adacore.com> wrote:
> > I may be missing something, but it seems like special casing
> > EVAL_AVOID_SIDE_EFFECTS for DIV/MOD/REM is no longer useful here
>
> I don't think this is right. EVAL_AVOID_SIDE_EFFECTS is used when
> computing the actual value is not needed. For instance, when you do
> "ptype", the expression is evaluated in that mode.  So when you do
> "ptype 3 div 2", we don't do the division, we just know that we're only
> interested in the type of result.  So the expression evaluator will
> return a struct value of the correct type but with a bogus contents,
> instead of doing the division, only to discard the result down the road.
>
> So the code you suggested we remove is useful.

As I say, if the intent is to avoid the call to error(), I'd expect to
see tests for 1 >> 3.0, etc.  That will throw error ("Integer-only
operation on floating point number").  If that code is the code that's
missing, fine, except that I'd also change the comments describing
what EVAL_AVOID_SIDE_EFFECTS is for:

    EVAL_AVOID_SIDE_EFFECTS     /* Don't modify any variables or
                                   call any functions.  The value
                                   returned will have the correct
                                   type, and will have an
                                   approximately correct lvalue
                                   type (inaccuracy: anything that is
                                   listed as being in a register in
                                   the function in which it was
                                   declared will be lval_register).  */

One can believe the intent that side effects in this particular case
includes throwing error(), but the docs should be explicit on this.


  parent reply	other threads:[~2008-01-29 15:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <002301c85c12$a73a4640$f5aed2c0$@u-strasbg.fr>
2008-01-29  5:26 ` Doug Evans
2008-01-29  6:32   ` Doug Evans
2008-01-29 14:42     ` Daniel Jacobowitz
2008-01-29 16:16       ` Doug Evans
2008-01-29 16:24         ` Doug Evans
2008-01-29 16:37           ` Daniel Jacobowitz
2008-01-29  7:35   ` Joel Brobecker
2008-01-29  7:51     ` Pierre Muller
2008-01-29 13:46       ` Daniel Jacobowitz
2008-01-29 15:17         ` Pierre Muller
2008-01-29 16:25           ` 'Daniel Jacobowitz'
2008-01-29 16:04       ` Doug Evans
2008-01-29 16:34         ` Pierre Muller
2008-01-29 15:51     ` Doug Evans [this message]
2008-01-29 16:49       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e394668d0801290748y54ffd52fn4a5f5f66cc71d865@mail.gmail.com \
    --to=dje@google.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=muller@ics.u-strasbg.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox