Clang Project

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