xref: /llvm-project/clang/test/CodeGen/arrayderef.c (revision 85e5156598b1bbad0ae41cf4d0d5b845dd655ffd)
1*85e51565SEric Christopher // RUN: %clang_cc1 %s -emit-llvm -O1 -o - | FileCheck %s
2*85e51565SEric Christopher // The load here was getting lost because this code was close
3*85e51565SEric Christopher // enough to the traditional (wrong) implementation of offsetof
4*85e51565SEric Christopher // to confuse the gcc FE.  8629268.
5*85e51565SEric Christopher 
6*85e51565SEric Christopher struct foo {
7*85e51565SEric Christopher   int x;
8*85e51565SEric Christopher   int *y;
9*85e51565SEric Christopher };
10*85e51565SEric Christopher 
11*85e51565SEric Christopher struct foo Foo[1];
12*85e51565SEric Christopher 
bar(unsigned int ix)13*85e51565SEric Christopher int * bar(unsigned int ix) {
14*85e51565SEric Christopher // CHECK: load
15*85e51565SEric Christopher   return &Foo->y[ix];
16*85e51565SEric Christopher }
17