summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/ubsan-bitfields.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Retry: [ubsan] Detect UB loads from bitfieldsVedant Kumar2017-03-091-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | It's possible to load out-of-range values from bitfields backed by a boolean or an enum. Check for UB loads from bitfields. This is the motivating example: struct S { BOOL b : 1; // Signed ObjC BOOL. }; S s; s.b = 1; // This is actually stored as -1. if (s.b == 1) // Evaluates to false, -1 != 1. ... Changes since the original commit: - Single-bit bools are a special case (see CGF::EmitFromMemory), and we can't avoid dealing with them when loading from a bitfield. Don't try to insert a check in this case. Differential Revision: https://reviews.llvm.org/D30423 llvm-svn: 297389
* Revert "[ubsan] Detect UB loads from bitfields"Vedant Kumar2017-03-091-21/+0
| | | | | | | | This reverts commit r297298. It breaks the self-host on this bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/962/steps/build%20clang%2Fubsan/logs/stdio llvm-svn: 297331
* [ubsan] Detect UB loads from bitfieldsVedant Kumar2017-03-081-0/+21
It's possible to load out-of-range values from bitfields backed by a boolean or an enum. Check for UB loads from bitfields. This is the motivating example: struct S { BOOL b : 1; // Signed ObjC BOOL. }; S s; s.b = 1; // This is actually stored as -1. if (s.b == 1) // Evaluates to false, -1 != 1. ... Differential Revision: https://reviews.llvm.org/D30423 llvm-svn: 297298
OpenPOWER on IntegriCloud