[PATCH] D53949: [clang][CodeGen] Implicit Conversion Sanitizer: discover the world of CompoundAssign operators
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 31 14:38:48 PDT 2018
rsmith added a comment.
> In https://reviews.llvm.org/D53949#1282884, @regehr wrote:
>
>> The C99 standard (6.5.3.1.2) appears to be very clear on this point: "The expression ++E is equivalent to (E+=1)."
>
>
> That is clearly not what clang is doing here.
How so? E += 1 is equivalent to E = E + 1, which effectively performs the arithmetic in the promoted type, which is what clang does. (The potential promotion from E to int can't change the value, but the implicit conversion from the type of E + 1 to the type of E can, if E's type is not a promoted type.)
Repository:
rC Clang
https://reviews.llvm.org/D53949
More information about the cfe-commits
mailing list