]> granicus.if.org Git - clang/commit
[Sema] Warn when shifting a negative value.
authorDavide Italiano <davide@freebsd.org>
Mon, 6 Jul 2015 18:02:09 +0000 (18:02 +0000)
committerDavide Italiano <davide@freebsd.org>
Mon, 6 Jul 2015 18:02:09 +0000 (18:02 +0000)
commit681829bec2957f9c23bbba87170836e4d360a237
treed52e5e7b86d27c9cc3d91db05fc41679c72e6392
parent064bc4f4b64c1fe5c8080d4512b74e36aba07dd0
[Sema] Warn when shifting a negative value.

Example:
 % ./clang -Wshift-negative-value emit.c
emit.c:3:14: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
  int a = -1 << 3;
          ~~ ^
1 warning generated.

PR: 24026
Differential Revision:  http://reviews.llvm.org/D10938
Reviewed by: rsmith

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241478 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp
test/CXX/expr/expr.const/p2-0x.cpp
test/Sema/shift.c