[LLVMdev] Is this a bug in clang?

John Regehr regehr at cs.utah.edu
Wed Apr 20 11:37:35 PDT 2011


> It's the evaluation of the expression "i++ + i++" that result in undefined
> behavior. If you merely compile a program that contains the expression, the
> expression is never evaluated. You need to execute the program to have the
> expression be evaluated and behavior be undefined.

I don't think this is correct.  The standard does not make much of a 
distinction between compile time and run time, there is merely a "C 
implementation."

> For example, also, if you do `sizeof(i++ + i++)`, this behavior is perfectly
> fine, and not undefined behavior. Because the `i++` is not evaluated.

Probably also wrong.

John



More information about the llvm-dev mailing list