All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/3] xtf: avoid shifting a negative value
Date: Fri, 6 May 2016 15:57:26 +0100	[thread overview]
Message-ID: <572CB0D6.8020403@citrix.com> (raw)
In-Reply-To: <1462544723-48415-3-git-send-email-roger.pau@citrix.com>

On 06/05/16 15:25, Roger Pau Monne wrote:
> Because it's undefined behaviour.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  include/arch/x86/processor.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/arch/x86/processor.h b/include/arch/x86/processor.h
> index c9f253f..841953c 100644
> --- a/include/arch/x86/processor.h
> +++ b/include/arch/x86/processor.h
> @@ -134,7 +134,7 @@
>  /* Segment-based Error Code - supplemental constants. */
>  #define X86_EC_TABLE_MASK (3  << 1)
>  #define X86_EC_SEL_SHIFT  3
> -#define X86_EC_SEL_MASK   (-1 << X86_EC_SEL_SHIFT)
> +#define X86_EC_SEL_MASK   (-1U << X86_EC_SEL_SHIFT)

The resulting expression needs to be signed, to DTRT when implicitly
promoted.  I presume this was clang complaining?

Does using the constant (-9) work?

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-05-06 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 14:25 [PATCH 0/3] XTF: small fixes Roger Pau Monne
2016-05-06 14:25 ` [PATCH 1/3] xtf: don't re-define __noinline Roger Pau Monne
2016-05-06 14:25 ` [PATCH 2/3] xtf: avoid shifting a negative value Roger Pau Monne
2016-05-06 14:57   ` Andrew Cooper [this message]
2016-05-06 15:05     ` Andrew Cooper
2016-05-06 14:25 ` [PATCH 3/3] xtf: fix usage of "-executable" with find Roger Pau Monne
2016-05-06 14:46 ` [PATCH 0/3] XTF: small fixes Andrew Cooper

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=572CB0D6.8020403@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=roger.pau@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 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.