Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2018 21:07:19 -0800
From:      Conrad Meyer <cem@freebsd.org>
To:        Benjamin Kaduk <bjkfbsd@gmail.com>
Cc:        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:  <CAG6CVpWVstTHW2OkNTu9Yj7eZgcFNUvyZhB-P6EOB1gwLOcuBQ@mail.gmail.com>
In-Reply-To: <CAJ5_RoDQqBkPoDh5RH452zswKTX34O5eYeimGUwBps50FHE3Hw@mail.gmail.com>
References:  <201801190434.w0J4Y6i7086677@repo.freebsd.org> <CAJ5_RoAhGgkQTLXgHpYYOiupA=c6wK%2BpeAdT0Zjaw0n-ggAd1g@mail.gmail.com> <CAG6CVpVhLcY5ohnHW32raKic7MT5Q%2B7C9EA9dzwpQvbUXVH%2Big@mail.gmail.com> <CAJ5_RoDQqBkPoDh5RH452zswKTX34O5eYeimGUwBps50FHE3Hw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The spec says the behavior is undefined; not that the compiler has to
produce a warning or error message.  The compiler *does* get to
arbitrarily decide what it wants to do when it encounters UB.  It is
wholly free to implement this particular UB with the logical result
and no warning/error.

On Thu, Jan 18, 2018 at 8:54 PM, Benjamin Kaduk <bjkfbsd@gmail.com> wrote:
> On Thu, Jan 18, 2018 at 10:49 PM, Conrad Meyer <cem@freebsd.org> wrote:
>>
>> No.  It is the only logical result of a logical right shift larger
>> than the left operand.  The C standard may claim that is undefined,
>> but that does not change the only logical result (zero).
>>
>
> My point is that the compiler does not arbitrarily decide that this behavior
> merits
> a warning; the compiler is thoroughly grounded in the C language
> specification
> to do so.  The compiler does not adhere to our human standard of "logic"; it
> follows
> the language spec, warts and all.
>
> -Ben



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWVstTHW2OkNTu9Yj7eZgcFNUvyZhB-P6EOB1gwLOcuBQ>