The ++/-- operators are currently broken when -ftrapv is turned on. I have attached a program that demonstrates the bug. (I most recently demonstrated this in r110329.)
The cause is simple. In ScalarExprEmitter::EmitScalarPrePostIncDec() when -ftrapv is enabled, the incremented value is returned instead of being passed to the coded that stores the incremented value and decides which value to return. I have attached the fix.
David
prepost.c (566 Bytes)
clang_lib_CodeGen.diff (419 Bytes)