From: Marek Marczykowski <marmarek@invisiblethingslab.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Juergen Gross <jgross@suse.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] tools/kdd: silence gcc 8 warning a different way
Date: Mon, 16 Apr 2018 14:43:32 +0200 [thread overview]
Message-ID: <20180416124332.GK27518@mail-itl> (raw)
In-Reply-To: <5AD4906502000078001BBABF@prv1-mh.provo.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 1843 bytes --]
On Mon, Apr 16, 2018 at 06:00:37AM -0600, Jan Beulich wrote:
> >>> On 16.04.18 at 12:33, <wei.liu2@citrix.com> wrote:
> > On Thu, Apr 12, 2018 at 06:04:49AM -0600, Jan Beulich wrote:
> >> Older gcc doesn't like "#pragma GCC diagnostic" inside functions.
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >>
> >> --- a/tools/debugger/kdd/kdd.c
> >> +++ b/tools/debugger/kdd/kdd.c
> >> @@ -695,10 +695,10 @@ static void kdd_handle_read_ctrl(kdd_sta
> >> KDD_LOG(s, "Request outside of known control space\n");
> >> len = 0;
> >> } else {
> >> -#pragma GCC diagnostic push
> >> -#pragma GCC diagnostic ignored "-Warray-bounds"
> >> - memcpy(buf, ((uint8_t *)&ctrl.c32) + offset, len);
> >> -#pragma GCC diagnostic pop
> >> + /* Suppress bogus gcc 8 "out of bounds" warning. */
> >> + const uint8_t *src;
> >> + asm ("" : "=g" (src) : "0" ((uint8_t *)&ctrl.c32 + offset));
> >> + memcpy(buf, src, len);
> >
> > The code looks correct to me:
> >
> > Reviewed-by: Wei Liu <wei.liu2@citrix.com>
> >
> > This will hopefully also fix the issue Boris reported that some older
> > gcc (<4.6) doesn't support push and pop.
> >
> > This is the first time I see inline assembly is used to silence gcc.
> > ;-)
>
> And I'm not overly happy about it, but couldn't think of a better way
> without disabling said warning (or -Werror) altogether for the CU. If
> Ian's sketched out approach worked, I'd be quite happy to drop the
> patch here.
What about changing offset type to uint32_t (or similar), which also
mute the warning?
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-04-16 12:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 12:04 [PATCH] tools/kdd: silence gcc 8 warning a different way Jan Beulich
2018-04-16 8:29 ` Wei Liu
2018-04-16 15:20 ` Tim Deegan
2018-04-16 10:33 ` Wei Liu
2018-04-16 11:15 ` Ian Jackson
2018-04-16 12:00 ` Jan Beulich
2018-04-16 12:43 ` Marek Marczykowski [this message]
2018-04-23 14:21 ` Wei Liu
2018-04-16 13:26 ` Ian Jackson
2018-05-22 10:54 ` Wei Liu
2018-05-22 19:43 ` Marek Marczykowski
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=20180416124332.GK27518@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=jgross@suse.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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).