From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Hacks for building on gcc 7 / Fedora 26
Date: Thu, 20 Jul 2017 18:04:44 +0100 [thread overview]
Message-ID: <20170720170443.GG2456@work-vm> (raw)
In-Reply-To: <20170720164730.GP21566@redhat.com>
* Daniel P. Berrange (berrange@redhat.com) wrote:
> On Thu, Jul 20, 2017 at 05:15:49PM +0100, Dr. David Alan Gilbert wrote:
> > * Daniel P. Berrange (berrange@redhat.com) wrote:
> > > On Fri, Apr 07, 2017 at 03:38:47PM +0100, Dr. David Alan Gilbert wrote:
> > > > Hi,
> > > > Fedora 26 has gcc 7.0.1 which has the normal compliment
> > > > of new fussy warnings; so far I've posted :
> > > >
> > > > tests/check-qdict: Fix missing brackets
> > > > slirp/smb: Replace constant strings by glib string
> > > >
> > > > that fix one actual mistake and work around something it's being
> > > > fussy over.
> > > >
> > > > But I've also got a pile of hacks, attached below that I'm
> > > > not too sure what I'll do with them yet, but they're attached
> > > > for anyone else trying to build. Note they're smoke-only-tested.
> > > >
> > > > I also have gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346
> > > > filed for what I reckon is a couple of overly pessimistic warnings.
> > >
> > >
> > > > diff --git a/include/qemu/iov.h b/include/qemu/iov.h
> > > > index bd9fd55b0a..ebb0221140 100644
> > > > --- a/include/qemu/iov.h
> > > > +++ b/include/qemu/iov.h
> > > > @@ -46,7 +46,7 @@ static inline size_t
> > > > iov_from_buf(const struct iovec *iov, unsigned int iov_cnt,
> > > > size_t offset, const void *buf, size_t bytes)
> > > > {
> > > > - if (__builtin_constant_p(bytes) && iov_cnt &&
> > > > + if (__builtin_constant_p(bytes) && iov_cnt && bytes <= INT_MAX &&
> > > > offset <= iov[0].iov_len && bytes <= iov[0].iov_len - offset) {
> > > > memcpy(iov[0].iov_base + offset, buf, bytes);
> > > > return bytes;
> > > > @@ -59,7 +59,7 @@ static inline size_t
> > > > iov_to_buf(const struct iovec *iov, const unsigned int iov_cnt,
> > > > size_t offset, void *buf, size_t bytes)
> > > > {
> > > > - if (__builtin_constant_p(bytes) && iov_cnt &&
> > > > + if (__builtin_constant_p(bytes) && iov_cnt && bytes <= INT_MAX &&
> > > > offset <= iov[0].iov_len && bytes <= iov[0].iov_len - offset) {
> > > > memcpy(buf, iov[0].iov_base + offset, bytes);
> > > > return bytes;
> >
> > tbh I don't know what the right fix for this is; the gcc discussion
> > confused me as to why it thinks it can be a valid case.
>
> Even if gcc is broken in issuing a warning here, we still need to
> make it quiet so people on F26 and similarly new distros can build
> without warnings.
I agree.
> IMHO your patch is ok, or we could be alittle more explicit about
> catching just the case where you pass -1 for bytes, and have
>
> && bytes != -1
This seems bizarre to me since bytes is size_t bytes and size_t
is unsigned, so I'd have sympathy for a compiler that warned that
bytes != -1 was always true.
Dave
>
>
> Regards,
> Daniel
> --
> |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o- https://fstop138.berrange.com :|
> |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-07-20 17:04 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-07 14:38 [Qemu-devel] Hacks for building on gcc 7 / Fedora 26 Dr. David Alan Gilbert
2017-04-07 19:21 ` Philippe Mathieu-Daudé
2017-07-13 13:07 ` Philippe Mathieu-Daudé
2017-07-17 13:42 ` Eric Blake
2017-07-17 13:48 ` Eric Blake
2017-07-17 14:16 ` Gerd Hoffmann
2017-07-17 15:04 ` Eric Blake
2017-07-17 16:46 ` Dr. David Alan Gilbert
2017-07-17 17:22 ` Peter Maydell
2017-07-17 17:29 ` Eric Blake
2017-07-17 17:36 ` Peter Maydell
2017-07-17 18:10 ` Eric Blake
2017-07-17 18:48 ` Dr. David Alan Gilbert
2017-07-18 15:04 ` Philippe Mathieu-Daudé
2017-07-18 15:10 ` Eric Blake
2017-07-19 7:15 ` Thomas Huth
2017-07-17 17:46 ` Dr. David Alan Gilbert
2017-07-18 7:23 ` Daniel P. Berrange
2017-07-18 12:35 ` Eric Blake
2017-07-18 12:56 ` Daniel P. Berrange
2017-07-18 23:59 ` Richard Henderson
2017-07-19 0:34 ` Eric Blake
2017-04-12 23:54 ` no-reply
2017-07-20 10:50 ` Daniel P. Berrange
2017-07-20 12:10 ` Eric Blake
2017-07-20 16:15 ` Dr. David Alan Gilbert
2017-07-20 16:47 ` Daniel P. Berrange
2017-07-20 17:04 ` Dr. David Alan Gilbert [this message]
2017-07-20 17:06 ` Daniel P. Berrange
2017-07-20 18:36 ` Eric Blake
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=20170720170443.GG2456@work-vm \
--to=dgilbert@redhat.com \
--cc=berrange@redhat.com \
--cc=qemu-devel@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).