[LLVMdev] Is this a bug in clang?
joearms at gmail.com
Wed Apr 20 01:44:00 PDT 2011
On Wed, Apr 20, 2011 at 7:50 AM, John Regehr <regehr at cs.utah.edu> wrote:
>> So... Are 40 and 41 the only legal behaviors or are there more?
> Since the program invokes undefined behavior, anything goes.
> The compiler is perfectly within its rights to send a rude email to your
> department chair if you compile that code.
The problem is I can't represent undefined in C.
I guess I just let (i + i++) and (i++ + i) both evaluate to 42. Then +
become commutative :-)
It seems very strange to me that the ansi standard says "XXX is
undefined" and that both clang and gcc
can detect that something is undefined and that by default they
compile the offending code without
any feelings of guilt.
My compiler will vigorously refuse to compile such nonsense - there
will be no flags to change this
More information about the llvm-dev