public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [BUG] BINOP_DIV and ptyp command
@ 2008-01-21  9:47 Pierre Muller
  2008-01-29  4:56 ` Doug Evans
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Muller @ 2008-01-21  9:47 UTC (permalink / raw)
  To: gdb

The ptyp command returns inconsistent types for the c '/'(BINOP_DIV)
operator:

(gdb) ptyp 3 / 2
type = int
(gdb) p 3 / 2
$4 = 1
(gdb) ptyp 3.0 / 2
type = double
(gdb) p 3.0 / 2
$5 = 1.5
(gdb) ptyp 3 / 2.0
type = int
(gdb) p 3 / 2.0
$6 = 1.5

I suspect that this bug is due to the fact that
the type of this binary operator is inferred from the
left node type, but this is wrong in the case '3 / 2.0'


Pierre Muller


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

* Re: [BUG] BINOP_DIV and ptyp command
  2008-01-21  9:47 [BUG] BINOP_DIV and ptyp command Pierre Muller
@ 2008-01-29  4:56 ` Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2008-01-29  4:56 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb

[for completeness sake', I sent a proposed patch to the gdb-patches list]
http://sourceware.org/ml/gdb-patches/2008-01/msg00664.html

On Jan 21, 2008 1:47 AM, Pierre Muller <muller@ics.u-strasbg.fr> wrote:
> The ptyp command returns inconsistent types for the c '/'(BINOP_DIV)
> operator:
>
> (gdb) ptyp 3 / 2
> type = int
> (gdb) p 3 / 2
> $4 = 1
> (gdb) ptyp 3.0 / 2
> type = double
> (gdb) p 3.0 / 2
> $5 = 1.5
> (gdb) ptyp 3 / 2.0
> type = int
> (gdb) p 3 / 2.0
> $6 = 1.5
>
> I suspect that this bug is due to the fact that
> the type of this binary operator is inferred from the
> left node type, but this is wrong in the case '3 / 2.0'
>
>
> Pierre Muller
>
>
>

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

end of thread, other threads:[~2008-01-29  4:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-21  9:47 [BUG] BINOP_DIV and ptyp command Pierre Muller
2008-01-29  4:56 ` Doug Evans

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