xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/vlt_to_pointer.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc int c[1][3*2];
4*0a6a1f1dSLionel Sambuc // CHECK: @{{.+}} = {{.*}} global [1 x [6 x {{i[0-9]+}}]] zeroinitializer
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @f
f(int * const m,int (** v)[* m * 2])7*0a6a1f1dSLionel Sambuc int f(int * const m, int (**v)[*m * 2])
8*0a6a1f1dSLionel Sambuc {
9*0a6a1f1dSLionel Sambuc     return &(c[0][*m]) == &((*v)[0][*m]);
10*0a6a1f1dSLionel Sambuc     // CHECK: icmp
11*0a6a1f1dSLionel Sambuc     // CHECK: ret i{{[0-9]+}}
12*0a6a1f1dSLionel Sambuc }
13*0a6a1f1dSLionel Sambuc 
14*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @test
test(int n,int (* (* fn)(void))[n])15*0a6a1f1dSLionel Sambuc int test(int n, int (*(*fn)(void))[n]) {
16*0a6a1f1dSLionel Sambuc   return (*fn())[0];
17*0a6a1f1dSLionel Sambuc }
18*0a6a1f1dSLionel Sambuc 
19*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @main
main()20*0a6a1f1dSLionel Sambuc int main()
21*0a6a1f1dSLionel Sambuc {
22*0a6a1f1dSLionel Sambuc     int m = 3;
23*0a6a1f1dSLionel Sambuc     int (*d)[3*2] = c;
24*0a6a1f1dSLionel Sambuc     int (*fn[m])(void);
25*0a6a1f1dSLionel Sambuc     return f(&m, &d) + test(m, &fn);
26*0a6a1f1dSLionel Sambuc 
27*0a6a1f1dSLionel Sambuc     // CHECK: call {{.+}} @f(
28*0a6a1f1dSLionel Sambuc     // CHECK: ret i{{[0-9]+}}
29*0a6a1f1dSLionel Sambuc }
30*0a6a1f1dSLionel Sambuc 
31