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 <bjkf...@gmail.com> wrote:
> On Thu, Jan 18, 2018 at 10:49 PM, Conrad Meyer <c...@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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to