lebedev.ri added a comment. In https://reviews.llvm.org/D53949#1282884, @regehr wrote:
> I do not agree that ++ is performed on the original type. The C99 standard > (6.5.3.1.2) appears to be very clear on this point: "The expression ++E is > equivalent to (E+=1)." In https://reviews.llvm.org/D53949#1282911, @rsmith wrote: > > 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 (effectively) 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.) *effectively*. In other words, which sanitizer should be catching this? https://godbolt.org/z/AFpRWS Unless i'm misreading @regehr the promotions *should* happen, and this is supposed to be caught by *this* conversion sanitizer, not the usual overflow sanitizers. Repository: rC Clang https://reviews.llvm.org/D53949 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits