Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / offsetof.c
blob13b34ea62265a4cf4c959f35b0de9018695e2d12
1 // RUN: %clang_cc1 %s -emit-llvm -o %t
3 // PR2910
4 struct sockaddr_un {
5 unsigned char sun_len;
6 char sun_path[104];
7 };
9 int test(int len) {
10 return __builtin_offsetof(struct sockaddr_un, sun_path[len+1]);
13 // Ensure we can form the offset to a structure defined in the first argument
14 // without crashing or asserting on an invalid declaration (because the
15 // declaration is actually valid).
16 void c() { __builtin_offsetof(struct {int b;}, b); }