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 | 42a8cd37b23e6482f7a6f4c5264d0d39d680142e (patch) | |
tree | 125fdcb823ef13547797cb48798a9ca760adea1a /clang/test/CodeGen/pointer-arithmetic.c | |
parent | 1f6c7fe6a87583eecb49b00b02fbb529f45bac90 (diff) | |
download | bcm5719-llvm-42a8cd37b23e6482f7a6f4c5264d0d39d680142e.tar.gz bcm5719-llvm-42a8cd37b23e6482f7a6f4c5264d0d39d680142e.zip |
Handle pointer arithmetic on function pointers.
- <rdar://problem/6518844> Clang-generated bitcode crashes LLVM while compiling function pointer addition expression
llvm-svn: 62857
Diffstat (limited to 'clang/test/CodeGen/pointer-arithmetic.c')
-rw-r--r-- | clang/test/CodeGen/pointer-arithmetic.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/test/CodeGen/pointer-arithmetic.c b/clang/test/CodeGen/pointer-arithmetic.c index 3133c9effe4..23a6ab41a1c 100644 --- a/clang/test/CodeGen/pointer-arithmetic.c +++ b/clang/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); } |