1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu 2*67e74705SXin Li 3*67e74705SXin Li // PR15216 4*67e74705SXin Li // Don't crash when taking computing the offset of structs with large arrays. 5*67e74705SXin Li const unsigned long Size = (1l << 60); 6*67e74705SXin Li 7*67e74705SXin Li struct Chunk1 { 8*67e74705SXin Li char padding[Size]; 9*67e74705SXin Li char more_padding[1][Size]; 10*67e74705SXin Li char data; 11*67e74705SXin Li }; 12*67e74705SXin Li 13*67e74705SXin Li int test1 = __builtin_offsetof(struct Chunk1, data); 14*67e74705SXin Li 15*67e74705SXin Li struct Chunk2 { 16*67e74705SXin Li char padding[Size][Size][Size]; // expected-error 2{{array is too large}} 17*67e74705SXin Li char data; 18*67e74705SXin Li }; 19*67e74705SXin Li 20*67e74705SXin Li // FIXME: Remove this error when the constant evaluator learns to 21*67e74705SXin Li // ignore bad types. 22*67e74705SXin Li int test2 = __builtin_offsetof(struct Chunk2, data); // expected-error{{initializer element is not a compile-time constant}} 23