RE: [BUG] BINOP_DIV and ptyp command

Pierre Muller
2008-01-29T16:25:21Z

Doug, I tend to agree with you that
we should always call value_binop,
or never, not on all cases
except BINOP_DIV, BINOP_INTDIV, BINOP_REM and BINOP_MOD
this is not logical as you explained it.

The current code makes
those operators listed above act
differently from other operators for 'ptype' command
and lead to several cases where
(gdb) print EXPR
$? = EXPRESULT
(gdb) ptype $
returns another type than
(gdb) ptype EXPR

The implicit conversion rules in
value_binop are rather complicated...

Try for instance

(gdb) ptyp 1.5 * 2.5l
type = long double
but
(top-gdb) p 1.5 / 2.5l
$1 = 0.60000000000000000002168404344971009
(top-gdb) ptyp $
type = long double
(top-gdb) ptyp 1.5 / 2.5l
type = double

But anyhow,
(gdb) ptyp 1 * 2.5
type = double
but
(top-gdb) p 1 / 2.5
$1 = 0.40000000000000000002
(top-gdb) ptyp $
type = double
(top-gdb) ptyp 1 / 2.5
type = int
Is obviously a much bigger bug, no?

I don't care much about 'int' 'long int' or 'long long int'
but 'int' and 'double' are completely different story!

Pierre