https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118534
Bug ID: 118534 Summary: [15 Regression] constant evaluation failure with RAW_DATA_CST Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- // { dg-do compile { target c++14 } } // { dg-options "" } template<typename T> constexpr bool foo () { T x[160] = { #embed __FILE__ limit (160) }; const int y[160] = { 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, #embed __FILE__ limit (147) gnu::offset (13) }; unsigned long n = 13; for (T *p = x; n; --n, p++) *p = 42; for (int i = 0; i < 160; ++i) if (x[i] != y[i]) return false; return true; } int main () { static_assert (foo<int> ()); static_assert (foo<unsigned char> ()); } FAILs since the introduction of #embed optimizations for C++, while // { dg-do compile { target c++14 } } template<typename T> constexpr bool foo () { T x[160] = { #define I8 1, 2, 3, 4, 5, 6, 7, 8 #define I64 I8, I8, I8, I8, I8, I8, I8, I8 I64, I64, I8, I8, I8, I8 }; const int y[160] = { 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 6, 7, 8, I64, I64, I8, I8 }; unsigned long n = 13; for (T *p = x; n; --n, p++) *p = 42; for (int i = 0; i < 160; ++i) if (x[i] != y[i]) return false; return true; } int main () { static_assert (foo<int> ()); static_assert (foo<unsigned char> ()); } FAILed from r15-6339 till before r15-6448 and will fail again once r15-6339 is committed again.