summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-02-23 23:34:11 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-02-23 23:34:11 +0000
commit4c6fdca0357318933a0b14ea83c17560cde260af (patch)
treecf9e812f64731c3f9f0fb9649b2be1e37a9f1831 /clang/lib/Parse/ParseDecl.cpp
parente4b316c15cfbed5e612d8af0181fce80588dc06d (diff)
downloadbcm5719-llvm-4c6fdca0357318933a0b14ea83c17560cde260af.tar.gz
bcm5719-llvm-4c6fdca0357318933a0b14ea83c17560cde260af.zip
Implement a warning for known shift overflows on constant shift
expressions. Consider the code: int64_t i = 10 << 30; This compiles fine, but most developers expect it to produce the value for 10 gigs, not -2 gigs. This is actually undefined behavior because the LHS is a signed integer type. The warning is currently gated behind -Wshift-overflow. There is a special case where only the sign bit is overridden that gets a custom error message and is by default ignored. This case is much less likely to cause observed buggy behavior, it's just undefined behavior according to the spec. This warning can be enabled with -Wshift-sign-overflow. Original patch by Oleg Slezberg, with style tweaks and some correctness fixes by me. llvm-svn: 126342
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud