svn commit: r328159 - head/sys/modules

Conrad Meyer cem at freebsd.org
Fri Jan 19 05:07:22 UTC 2018


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 at gmail.com> wrote:
> On Thu, Jan 18, 2018 at 10:49 PM, Conrad Meyer <cem at 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


More information about the svn-src-all mailing list