https://bugs.llvm.org/show_bug.cgi?id=39519
Bug ID: 39519
Summary: clang incorrectly implements inc/dec?
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
https://reviews.llvm.org/D53949#1282884
@regehr
The C99 standard (6.5.3.1.2) appears to be very clear on this point: "The
expression ++E is equivalent to (E+=1)."
[17:52:50] <TNorthover> LebedevRI: John Regehr is right.
[17:53:32] <TNorthover> It also says "See the discussions of additive operators
for information on [...] conversions [...]".
[17:53:37] <LebedevRI> TNorthover: so clang is implementing inc/dec incorrectly
[17:54:25] <AaronBallman> LebedevRI: yeah, I agree with John on that
https://godbolt.org/z/qd-QV4
clang clearly does not do promotions in the c++; case.
The question at hand is:
* signed char c = 127; c++;
Is this UB? UBSan does not catch it.
* unsigned char c = 255; c++;
Is this (not ub!) unsigned integer overflow?
Integer sanitizer does not catch it.
If these aren't ub/overflows, then the computation should be done in some
promoted type?
If the computation is not done in promoted type, then conversion sanitizer will
not catch it either.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs