https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86164
--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Boris Kolpackov from comment #9)
> Any progress on this?
Patrick has fixed it now.
> I get the segfault (due to stack overflow) with the following trivial regex:
>
> regex re ("#+",);
> regex_search (string (32 * 1024, '#'), re);
>
> In comparison, MSVC's implementation crashes on much larger input (in the
> above test it is still able to match 4MB string) while libc++ doesn't seem
> to have any stack-related limits (I was able to match 40MB).
>
> I see two issues here:
>
> 1. It would have been nice if implementation-related limits were reported
> with an exception rather than a crash.
It fails with bad_alloc now. I've opened Bug 123895 to improve that so that it
throws std::regex_error.
> 2. The limits seem to be really low, both practically (matching 32KB doesn't
> feel unreasonable) and compared to other implementations.
On a system with 32GB of RAM it can match 256MB strings, but not 512MB. It's
only limited by RAM though. On a system with 64GB of RAM I am able to match
512MB (I didn't test anything larger).