On 10/23/19 9:45 AM, Laurent Vivier wrote:
The C rules for ternary type promotion guarantee that the MIN macro
produces the correct type without the cast ('cond ? int64_t : int32_t'
produces int64_t).
gdb seems to disagree with that:
(gdb) whatis l
type = long long
(gdb) whatis i
type = int
(gdb) whatis 1 ? l : i
type = long long
(gdb) whatis 0 ? l : i
type = int
It looks like you've found a gdb bug.
C99 6.5.15 p5 states:
"If both the second and third operands have arithmetic type, the result
type that would be determined by the usual arithmetic conversions, were
they applied to those two operands, is the type of the result."
and the usual arithmetic conversion of 'long long OP int' is 'long
long', per 6.3.1.8.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org