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