[PATCH] D29437: [ubsan] Detect signed overflow UB in remainder operations

2017-02-24 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL296214: [ubsan] Detect signed overflow UB in remainder operations (authored by vedantk). Changed prior to commit: https://reviews.llvm.org/D29437?vs=89734&id=89753#toc Repository: rL LLVM https://re

[PATCH] D29437: [ubsan] Detect signed overflow UB in remainder operations

2017-02-24 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision. efriedma added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D29437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/

[PATCH] D29437: [ubsan] Detect signed overflow UB in remainder operations

2017-02-24 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 89734. vsk added a comment. - Add a small test that shows why the 'isIntegerType' check is required (we'd crash otherwise). https://reviews.llvm.org/D29437 Files: lib/CodeGen/CGExprScalar.cpp test/CodeGen/ubsan-promoted-arith.cpp Index: test/CodeGen/ubsa

[PATCH] D29437: [ubsan] Detect signed overflow UB in remainder operations

2017-02-24 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:2380 + CGF.SanOpts.has(SanitizerKind::SignedIntegerOverflow)) && + Ops.Ty->isIntegerType()) { CodeGenFunction::SanitizerScope SanScope(&CGF); I don't think you need the isInt

[PATCH] D29437: [ubsan] Detect signed overflow UB in remainder operations

2017-02-02 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment. In https://reviews.llvm.org/D29437#664379, @regehr wrote: > Does this check need to be sensitive to the dialect of C/C++ that the user > asked for? I know that it used to be the case that the standard could be read > either way for this case, but as you observe it is now un

[PATCH] D29437: [ubsan] Detect signed overflow UB in remainder operations

2017-02-01 Thread John Regehr via Phabricator via cfe-commits
regehr added a comment. Does this check need to be sensitive to the dialect of C/C++ that the user asked for? I know that it used to be the case that the standard could be read either way for this case, but as you observe it is now unambiguously UB. https://reviews.llvm.org/D29437 _

[PATCH] D29437: [ubsan] Detect signed overflow UB in remainder operations

2017-02-01 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision. Teach ubsan to diagnose remainder operations which have undefined behavior due to signed overflow. My copy of the C11 spec draft (6.5.5.6) says that: if the quotient a/b is representable, (a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is und