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