[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/kdd: silence gcc 8 warning a different way




At 09:29 +0100 on 16 Apr (1523870989), Wei Liu wrote:
> Cc Tim
> 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@xxxxxxxx>
> > 
> > --- 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));

That's terrifying!  Does casting the offset to uint32_t not DTRT?

Tim.

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.