llvm-project/clang/test/AST/absurdly_big_struct.cpp
kd0608 a6339d0e58
[clang]Fix Handle structs exceeding 1EB size limit (#146032)
When declaring multiple arrays of 1 ExaByte in a struct, the offset can
exceed 2EB, causing incorrect struct size reporting (only 1EB). This fix
ensures an error is thrown, preventing the generation of incorrect
assembly. #60272
2025-07-01 16:48:41 +05:30

14 lines
405 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s -triple x86_64-linux-gnu
struct a { // expected-error {{structure 'a' is too large, which exceeds maximum allowed size of 1152921504606846976 bytes}}
char x[1ull<<60];
char x2[1ull<<60];
};
a z[1];
long long x() { return sizeof(a); }
long long x2() { return sizeof(a::x); }
long long x3() { return sizeof(a::x2); }
long long x4() { return sizeof(z); }