summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-04-16 19:23:57 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-04-16 19:23:57 +0000
commit2850376184b7e7aa81b5034ba44b001f8c55e07a (patch)
treec51e1f08f3dae46bbacd00330c6a909a035513bd /test
parente9836a27cf93a58305ff3cf6d75ddc399c7d8ebf (diff)
Per Richard's comments on r154794, add the checks necessary to handle constant-folding relational comparisons safely in case the user is using -fwrapv or equivalent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Sema/const-eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c
index 3894d73d60..bc8b227ac8 100644
--- a/test/Sema/const-eval.c
+++ b/test/Sema/const-eval.c
@@ -125,3 +125,9 @@ EVAL_EXPR(44, "x"[0]); // expected-error {{variable length array}}
// <rdar://problem/10962435>
EVAL_EXPR(45, ((char*)-1) + 1 == 0 ? 1 : -1)
EVAL_EXPR(46, ((char*)-1) + 1 < (char*) -1 ? 1 : -1)
+EVAL_EXPR(47, &x < &x + 1 ? 1 : -1)
+EVAL_EXPR(48, &x != &x - 1 ? 1 : -1)
+EVAL_EXPR(49, &x < &x - 100 ? 1 : -1) // expected-error {{must have a constant size}}
+
+extern struct Test50S Test50;
+EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned)&Test50 + 10)) // expected-error {{must have a constant size}}