Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jan 2018 11:42:31 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        "Conrad E. Meyer" <cem@freebsd.org>
Cc:        John Baldwin <jhb@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r328159 - head/sys/modules
Message-ID:  <CANCZdfpiXXocsQLS7iXq=4JnvdQggBrRyuJL7jVUJfvW59d8hw@mail.gmail.com>
In-Reply-To: <CAG6CVpVSjSbOwM=ktSJAjfapVNTFeNpnfZ1tMy-2-MKu9Rsmuw@mail.gmail.com>
References:  <201801190434.w0J4Y6i7086677@repo.freebsd.org> <2915608.v56yfz43Ej@ralph.baldwin.cx> <CAG6CVpVSjSbOwM=ktSJAjfapVNTFeNpnfZ1tMy-2-MKu9Rsmuw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 19, 2018 at 11:31 AM, Conrad Meyer <cem@freebsd.org> wrote:

> On Fri, Jan 19, 2018 at 9:51 AM, John Baldwin <jhb@freebsd.org> wrote:
> > On Friday, January 19, 2018 04:34:06 AM Conrad Meyer wrote:
> >>   The logical result of a right shift >=3D the width of a type is zero=
,
> but our
> >>   compiler decides this is a warning (and thus, error).  Just remove
> ccp(4)
> >>   from i386.
> >
> > You would think that.  The shift instructions on x86 effectively ignore
> the
> > upper bits of the count, so a 33-bit shift on i386 ends up being a 1-bi=
t
> shift,
> > etc. IIRC.
>
> This never becomes a shift instruction on x86 or any other arch =E2=80=94=
 it's
> a constant before it reaches machine code
>

I think what John is getting at is that one's notions of what a logical
shift left should do should be tempered with real world experience which
says they don't behave that way always...

I do hope we're all in violent agreement that, no matter how crazy we think
it might be, avoiding the UB zone as much as possible is generally
desirable. It certainly is in this case.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpiXXocsQLS7iXq=4JnvdQggBrRyuJL7jVUJfvW59d8hw>