vsk added inline comments.
================
Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:21
+ // CHECK: call void @__ubsan_handle_load_invalid_value
+ return s->e1;
+}
----------------
vsk wrote:
> arphaman wrote:
> > Can we avoid the check if the bitfield is 2 bits wide?
> I don't think so, because if the user memset()'s the memory backing the
> struct, we could still load a value outside of {1, 2, 3} from the bitfield.
Sorry, I misread your question as 'if the enum can be represented in 2 bits'.
You're right, the check can be skipped if the _bitfield_ is 2 bits wide. I
think this can be handled along with the 1-bit unsigned BOOL case in a follow
up.
https://reviews.llvm.org/D30423
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits