qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>, Frediano Ziglio <fziglio@redhat.com>
Cc: qemu-trivial@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms
Date: Wed, 23 Oct 2019 09:51:09 -0500	[thread overview]
Message-ID: <173d8641-ff6b-adc4-b0d4-f4dd5909f87c@redhat.com> (raw)
In-Reply-To: <8b52c02c-1e26-4ac7-3f79-db4459f9c178@vivier.eu>

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



  reply	other threads:[~2019-10-23 14:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 12:26 [PATCH 1/3] util/async: avoid useless cast Frediano Ziglio
2019-10-23 12:26 ` [PATCH 2/3] event_notifier: avoid dandling file descriptor in event_notifier_cleanup Frediano Ziglio
2019-10-23 13:42   ` Laurent Vivier
2019-10-24 17:27   ` Laurent Vivier
2019-10-23 12:26 ` [PATCH 3/3] qemu-timer: reuse MIN macro in qemu_timeout_ns_to_ms Frediano Ziglio
2019-10-23 13:42   ` Laurent Vivier
2019-10-23 14:12     ` Eric Blake
2019-10-23 14:15       ` Frediano Ziglio
2019-10-23 14:23         ` Eric Blake
2019-10-23 14:45           ` Laurent Vivier
2019-10-23 14:51             ` Eric Blake [this message]
2019-10-23 14:58               ` Laurent Vivier
2019-10-24 17:31   ` Laurent Vivier
2019-10-24 18:03     ` Eric Blake
2019-10-24 18:11       ` Laurent Vivier
2019-10-24 20:55         ` Eric Blake
2019-10-23 13:44 ` [PATCH 1/3] util/async: avoid useless cast Laurent Vivier
2019-10-24 17:26 ` Laurent Vivier

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=173d8641-ff6b-adc4-b0d4-f4dd5909f87c@redhat.com \
    --to=eblake@redhat.com \
    --cc=fziglio@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).