diff options
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r-- | clang/test/CodeGen/object-size.c | 22 |
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"); } |