All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Juergen Gross <jgross@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Marek Marczykowski <marmarek@invisiblethingslab.com>
Subject: Re: [PATCH] tools/kdd: silence gcc 8 warning a different way
Date: Mon, 16 Apr 2018 11:33:32 +0100	[thread overview]
Message-ID: <20180416103332.jqap6zhrsm3aul3z@citrix.com> (raw)
In-Reply-To: <5ACF678102000078001BAA8E@prv1-mh.provo.novell.com>

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.
;-)

>          }
>      }
>  
> 
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-04-16 10:33 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 [this message]
2018-04-16 11:15   ` Ian Jackson
2018-04-16 12:00   ` Jan Beulich
2018-04-16 12:43     ` Marek Marczykowski
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=20180416103332.jqap6zhrsm3aul3z@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=marmarek@invisiblethingslab.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.