>>> On 16.04.18 at 12:33, <wei.l...@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 <jbeul...@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.l...@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.

Jan



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

Reply via email to