vsk updated this revision to Diff 91030.
vsk added a comment.
- Make check-not's a bit stricter per Filipe's comment.
- Add a negative test for fixed enums.
https://reviews.llvm.org/D30729
Files:
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGenCXX/ubsan-bitfields.cpp
Ind
vsk added a comment.
In https://reviews.llvm.org/D30729#695463, @arphaman wrote:
> You should also add a test for `enum E : unsigned`.
Ubsan doesn't try to infer the range of enums with a fixed, underlying type.
I'll add a test case to make sure we don't insert a check.
Com
filcab added inline comments.
Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:39
+ // CHECK-NOT: !nosanitize
+ return s->e3;
+}
Add checks/check-nots to make sure the thing you don't want isn't emitted, not
just `!nosanitize`
The checks help document what you'
arphaman added a comment.
You should also add a test for `enum E : unsigned`.
https://reviews.llvm.org/D30729
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
vsk updated this revision to Diff 90975.
vsk added a comment.
- Fix an incorrect comment on the field "e2" in struct S. We emit a check for
it because 0b11 = -1 = 3.
- Skip the range check on the field "e2" in struct S2, because the range of the
bitfield is the same as the range clang infers for
vsk created this revision.
UBSan can check that scalar loads provide in-range values. When we load
a value from a bitfield, we know that the range of the value is
constrained by the bitfield's width. This patch teaches UBSan how to use
that information to skip emitting some range checks.
This dep