qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hanna Reitz <hreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH] qcow2: Silence clang -m32 compiler warning
Date: Tue, 12 Oct 2021 09:37:48 +0200	[thread overview]
Message-ID: <dd96f766-26ca-de6d-911f-8352f6b27a5f@redhat.com> (raw)
In-Reply-To: <20211011162402.2wqnhxof2r52637w@redhat.com>

On 11.10.21 18:24, Eric Blake wrote:
> On Mon, Oct 11, 2021 at 05:50:31PM +0200, Hanna Reitz wrote:
>> With -m32, size_t is generally only a uint32_t.  That makes clang
>> complain that in the assertion
>>
>>    assert(qiov->size <= INT64_MAX);
>>
>> the range of the type of qiov->size (size_t) is too small for any of its
>> values to ever exceed INT64_MAX.
> Yep, I'm not surprised that we hit that.
>
>> Cast qiov->size to uint64_t to silence clang.
>>
>> Fixes: f7ef38dd1310d7d9db76d0aa16899cbc5744f36d
>>         ("block: use int64_t instead of uint64_t in driver read
>>         handlers")
>> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
>> ---
>> I don't know whether this is the best possible solution, or whether we
>> should care about this at all (I personally think it's basically just
>> wrong for clang to warn about always-true conditions in assertions), but
>> I thought I might as well just send this patch as the basis for a
>> discussion.
> I agree that the compiler is overly noisy, but the fix is simple
> enough that I'm fine with it as written.

Well, I just hope clang won’t become even more clever in the future and 
realize the cast has no real effect...

> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> Since the original went through my tree, I'm happy to take this one
> through my NBD tree as well.

Thanks!

Hanna



      reply	other threads:[~2021-10-12  7:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 15:50 [PATCH] qcow2: Silence clang -m32 compiler warning Hanna Reitz
2021-10-11 16:24 ` Eric Blake
2021-10-12  7:37   ` Hanna Reitz [this message]

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=dd96f766-26ca-de6d-911f-8352f6b27a5f@redhat.com \
    --to=hreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /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).