diff options
author | Mike Stump <mrs@apple.com> | 2009-10-26 21:38:39 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-10-26 21:38:39 +0000 |
commit | 06bc9bcc705e5fee714d4b00c3c3c9f01715c195 (patch) | |
tree | d37641e8ad8c520bbf3928b8f7ed8745961e70ae /test/CodeGen/object-size.c | |
parent | 07e72fd5cbfa46a5e9459a057ec0077cd4167d7f (diff) |
__builtin_object_size refinements. When we run out of object, be sure
to clamp at 0 bytes left. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/object-size.c')
-rw-r--r-- | test/CodeGen/object-size.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c index b686116989..36dc341e93 100644 --- a/test/CodeGen/object-size.c +++ b/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"); } |