https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119591
Bug ID: 119591 Summary: Concept constraint expression normalization uses too much memory Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marco.rubini08 at gmail dot com Target Milestone: --- Consider this code ``` template <int X> concept C1 = (X, true); template<int X> concept C2 = C1<X + X - X*2 + X - X + 1>; template<int X> concept C3 = C2<X + X - X*2 + X - X + 1>; template<int X> concept C4 = C3<X + X - X*2 + X - X + 1>; template<int X> concept C5 = C4<X + X - X*2 + X - X + 1>; template<int X> concept C6 = C5<X + X - X*2 + X - X + 1>; template<int X> concept C7 = C6<X + X - X*2 + X - X + 1>; template<int X> concept C8 = C7<X + X - X*2 + X - X + 1>; template<int X> concept C9 = C8<X + X - X*2 + X - X + 1>; template<int X> concept C10 = C9<X + X - X*2 + X - X + 1>; template<int X> concept C11 = C10<X + X - X*2 + X - X + 1>; static_assert(C11<0>); ``` GCC uses ~2GB of memory to compile. I think there is an exponential blowup issue in the size of atomic constraints. If the bug is confirmed, I think it is possible to compress the constraint expressions that are formed during normalization, to decrease their memory footprint (but not their "real" size), and could start working on a patch.