diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-01-23 18:51:09 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-01-23 18:51:09 +0000 |
commit | b09fae74acfae7af8b3d31b9638a0aa0fdf7c7ac (patch) | |
tree | 2d64d584d2009907242565ce07f6671c5e82849b /test/CodeGen/pointer-arithmetic.c | |
parent | 863c486fcb6162495a94fddf7ac8409de2638995 (diff) |
Handle pointer arithmetic on function pointers.
- <rdar://problem/6518844> Clang-generated bitcode crashes LLVM while compiling function pointer addition expression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62857 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/pointer-arithmetic.c')
-rw-r--r-- | test/CodeGen/pointer-arithmetic.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/CodeGen/pointer-arithmetic.c b/test/CodeGen/pointer-arithmetic.c index 3133c9effe..23a6ab41a1 100644 --- a/test/CodeGen/pointer-arithmetic.c +++ b/test/CodeGen/pointer-arithmetic.c @@ -1,7 +1,22 @@ -// RUN: clang -emit-llvm %s -o %t +// RUN: clang -S %s -o %t typedef int Int; -int test1(int *a, Int *b) { return a - b; } +int f0(int *a, Int *b) { return a - b; } -int test2(const char *a, char *b) { return b - a; } +int f1(const char *a, char *b) { return b - a; } + +// GNU extensions +typedef void (*FP)(void); +void *f2(void *a, int b) { return a + b; } +void *f2_1(void *a, int b) { return (a += b); } +void *f3(int a, void *b) { return a + b; } +void *f3_1(int a, void *b) { return (a += b); } +void *f4(void *a, int b) { return a - b; } +void *f4_1(void *a, int b) { return (a -= b); } +FP f5(FP a, int b) { return a + b; } +FP f5_1(FP a, int b) { return (a += b); } +FP f6(int a, FP b) { return a + b; } +FP f6_1(int a, FP b) { return (a += b); } +FP f7(FP a, int b) { return a - b; } +FP f7_1(FP a, int b) { return (a -= b); } |