[PATCH] D33563: Track whether a unary operation can overflow

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 14:23:08 PST 2018


aaron.ballman added inline comments.


================
Comment at: test/Misc/ast-dump-stmt.c:66
+  // CHECK:        ImplicitCastExpr
+  // CHECK:          DeclRefExpr{{.*}}'T2' 'int'
+}
----------------
efriedma wrote:
> aaron.ballman wrote:
> > efriedma wrote:
> > > What does it mean for bitwise complement to "overflow"?
> > When the sign bit flips on a signed value, e.g., `~0`.
> Bitwise complement always flips the sign bit; calling that an "overflow" doesn't seem useful.
For reference, I am upstreaming some changes we needed for an out-of-tree project, so "useful" kinda depends on context. However, I looked at our uses of this functionality and I'm not convinced we need this to report overflows, so I've made the change to not report overflow on a one's complement operand.


https://reviews.llvm.org/D33563





More information about the cfe-commits mailing list