summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-10-26 21:38:39 +0000
committerMike Stump <mrs@apple.com>2009-10-26 21:38:39 +0000
commit10bd7e1c5b355a193a59e3b3fdfe632f4d977c52 (patch)
tree14246152bf302c87659890a166751a1e20750710 /clang/test/CodeGen
parent72af806797ebbd73173fb15a0c43de339646e771 (diff)
downloadbcm5719-llvm-10bd7e1c5b355a193a59e3b3fdfe632f4d977c52.tar.gz
bcm5719-llvm-10bd7e1c5b355a193a59e3b3fdfe632f4d977c52.zip
__builtin_object_size refinements. When we run out of object, be sure
to clamp at 0 bytes left. WIP. llvm-svn: 85157
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/object-size.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/clang/test/CodeGen/object-size.c b/clang/test/CodeGen/object-size.c
index b6861169893..36dc341e932 100644
--- a/clang/test/CodeGen/object-size.c
+++ b/clang/test/CodeGen/object-size.c
@@ -21,13 +21,29 @@ void test2() {
strcpy(gbuf, "Hi there");
}
+void test3() {
+ // CHECK: movabsq $0, %rdx
+ // CHECK-NEXT: movq %rax, %rdi
+ // CHECK-NEXT: movq %rcx, %rsi
+ // CHECK-NEXT: call ___strcpy_chk
+ strcpy(&gbuf[100], "Hi there");
+}
+
void test4() {
+ // CHECK: movabsq $0, %rdx
+ // CHECK-NEXT: movq %rax, %rdi
+ // CHECK-NEXT: movq %rcx, %rsi
+ // CHECK-NEXT: call ___strcpy_chk
+ strcpy((char*)(void*)&gbuf[-1], "Hi there");
+}
+
+void test5() {
// CHECK: call ___inline_strcpy_chk
- strcpy(gp, "Hi");
+ strcpy(gp, "Hi there");
}
-void test3() {
+void test6() {
int i;
// CHECK: call ___inline_strcpy_chk
- strcpy((++i, gbuf), "Hi");
+ strcpy((++i, gbuf), "Hi there");
}
OpenPOWER on IntegriCloud