Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Pierre Muller <muller@ics.u-strasbg.fr>
Cc: gdb-patches@sourceware.org
Subject: Re: [Patch] p-exp.y: Typecast left operand of BINOP_DIV to long 	double
Date: Thu, 31 Jan 2008 22:43:00 -0000	[thread overview]
Message-ID: <20080131222641.GD6715@caradoc.them.org> (raw)
In-Reply-To: <000c01c861c5$149352b0$3db9f810$@u-strasbg.fr>

On Mon, Jan 28, 2008 at 04:47:26PM +0100, Pierre Muller wrote:
>   Could someone please confirm that the
> way I inserted the implicit typecast in the parser is
> correct?
>   All comments most welcome.

It looks OK to me.  Does the type of the left operand completely
determine the type of the operation, or do you need to worry about the
type of the right-hand exp too before you cast?

> @@ -367,7 +370,15 @@ exp        :       exp '*' exp
>                         { write_exp_elt_opcode (BINOP_MUL); }
>         ;
> 
> -exp    :       exp '/' exp
> +exp    :       exp '/' {
> +                         if (current_type && is_integral_type
> (current_type))
> +                           {
> +                             write_exp_elt_opcode (UNOP_CAST);
> +                             write_exp_elt_type (builtin_type_long_double);
> +                             write_exp_elt_opcode (UNOP_CAST);
> +                           }
> +                       }
> +               exp
>                         { write_exp_elt_opcode (BINOP_DIV); }
>         ;
> 

Won't current_type still be integral after this?  Try 1 / 2 / 3.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2008-01-31 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-28 17:08 Pierre Muller
2008-01-31 22:43 ` Daniel Jacobowitz [this message]
2008-02-01  7:29   ` Pierre Muller
2008-02-01 14:16     ` 'Daniel Jacobowitz'
2008-02-01 15:55       ` Pierre Muller
2008-02-01 17:00         ` Doug Evans
2008-02-01 17:04           ` 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=20080131222641.GD6715@caradoc.them.org \
    --to=drow@false.org \
    --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