aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/integer-overflow.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-12Add additional testcases for nsw markings on ++ and --.Eli Friedman1-3/+27
clang has generated correct IR for char/short decrement since r126816, but we didn't have any test coverage for decrement. Patch by Andrew Rogers. llvm-svn: 291805
2015-07-25[CodeGen] Don't UBSan-ize the argument to __builtin_frame_addressDavid Majnemer1-0/+7
__builtin_frame_address requires its argument to be a constant expression which already implies that it cannot have undefined behavior. However, we used EmitScalarExpr to emit the argument causing UBSan to try to check for overflow. Instead, use the constant expression emission system. This fixes PR24256. llvm-svn: 243206
2015-04-23Unify the way we report overflow in increment/decrement operator.Alexey Samsonov1-2/+2
Summary: Make sure signed overflow in "x--" is checked with llvm.ssub.with.overflow intrinsic and is reported as: "-2147483648 - 1 cannot be represented in type 'int'" instead of: "-2147483648 + -1 cannot be represented in type 'int'" , like we do for unsigned overflow. Test Plan: clang + compiler-rt regression test suite Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8236 llvm-svn: 235568
2015-02-27Update Clang tests to handle explicitly typed gep changes in LLVM.David Blaikie1-4/+4
llvm-svn: 230783
2013-08-15CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin1-3/+3
tests fail. llvm-svn: 188447
2012-11-05Use the individual -fsanitize=<...> arguments to control which of the UBSanRichard Smith1-1/+1
checks to enable. Remove frontend support for -fcatch-undefined-behavior, -faddress-sanitizer and -fthread-sanitizer now that they don't do anything. llvm-svn: 167413
2012-08-25-fcatch-undefined-behavior: add the -ftrapv checks to the set of things caughtRichard Smith1-0/+9
by this mode, and also check for signed left shift overflow. The rules for the latter are a little subtle: * neither C89 nor C++98 specify the behavior of a signed left shift at all * in C99 and C11, shifting a 1 bit into the sign bit has undefined behavior * in C++11, with core issue 1457, shifting a 1 bit *out* of the sign bit has undefined behavior As of this change, we use the C99 rules for all C language variants, and the C++11 rules for all C++ language variants. Once we have individual -fcatch-undefined-behavior= flags, this should be revisited. llvm-svn: 162634
2012-05-09hopefully fix a bunch of ARM buildbot failuresNuno Lopes1-4/+4
llvm-svn: 156513
2011-03-02PR9350: increment/decrement of char (and anything else narrower than int)Eli Friedman1-1/+7
can't overflow due to promotion rules; emit a wrapping add for those cases. llvm-svn: 126816
2011-03-01-fwrapv should turn off the inbounds markers from geps used for pointerChris Lattner1-0/+8
arithmetic. This is part of PR9256, it would be great if someone else wired up -fno-strict-overflow in the driver to -fwrapv. llvm-svn: 126718
2010-09-17Add a -ftrapv-handler= option which allows a handler to invoke instead of ↵David Chisnall1-0/+7
simply aborting when a signed operation overflows. This mirrors the (GCC-incompatible) behaviour from clang 1.0 and 1.1 when -ftrapv was specified, but allows the handler to be defined for each compilation unit. llvm-svn: 114192
2010-06-26fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.Chris Lattner1-5/+17
llvm-svn: 106962
2010-06-26Fix unary minus to trap on overflow with -ftrapv, refactoring binopChris Lattner1-1/+1
code so we can use it from VisitUnaryMinus. llvm-svn: 106957
2010-06-26Implement support for -fwrapv, rdar://7221421Chris Lattner1-0/+33
As part of this, pull together trapv handling into the same enum. This also add support for NSW multiplies. This also makes PCH disagreement on overflow behavior silent, since it really doesn't matter except for warnings and codegen (no macros get defined etc). llvm-svn: 106956