public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/67212] New: Infinite recurtion in std::regex_match
@ 2015-08-14  8:17 antialize at gmail dot com
  2015-08-14 17:01 ` [Bug libstdc++/67212] " timshen at gcc dot gnu.org
  2015-08-14 17:54 ` timshen at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: antialize at gmail dot com @ 2015-08-14  8:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67212

            Bug ID: 67212
           Summary: Infinite recurtion in std::regex_match
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antialize at gmail dot com
  Target Milestone: ---

Created attachment 36184
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36184&action=edit
Crashing program

The following code, crashes for some instances of line (as given in the
attachment):

std::regex lineExp("tpie::update_fractions\\([ ]*\"([^\"]+)\"[ ]*,[ ]*([^, ]+)[
]*,[ ]*([^\\) ]+)[ ]*\\);.*", std::regex::extended);
std::string line = <some_long_string_here>
std::smatch matches;
std::regex_match(line, matches, lineExp);


The crash ocure as we are running out of stack space in some possible infinite
recurtion. The context of the code can be seen here
https://github.com/thomasmoelhave/tpie/blob/cpp11-cleanup/tpie/fractional_progress.cpp#L64

The issue is triggered by:
g++ -std=c++11 test2.cc && ./a.out


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/67212] Infinite recurtion in std::regex_match
  2015-08-14  8:17 [Bug libstdc++/67212] New: Infinite recurtion in std::regex_match antialize at gmail dot com
@ 2015-08-14 17:01 ` timshen at gcc dot gnu.org
  2015-08-14 17:54 ` timshen at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-08-14 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67212

Tim Shen <timshen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Tim Shen <timshen at gcc dot gnu.org> ---
Mark as duplicate, since it's as well about stack overflow.

*** This bug has been marked as a duplicate of bug 61582 ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/67212] Infinite recurtion in std::regex_match
  2015-08-14  8:17 [Bug libstdc++/67212] New: Infinite recurtion in std::regex_match antialize at gmail dot com
  2015-08-14 17:01 ` [Bug libstdc++/67212] " timshen at gcc dot gnu.org
@ 2015-08-14 17:54 ` timshen at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-08-14 17:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67212

--- Comment #2 from Tim Shen <timshen at gcc dot gnu.org> ---
This isn't an "infinite" recursion, but just a deep one. I haven't implement
heap allocation and manual recursion yet. In the mean time, you may compile
your code with -O2 (tail recursion elimination may help), set a larger stack
size, or use -fsplit-stack.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-14 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14  8:17 [Bug libstdc++/67212] New: Infinite recurtion in std::regex_match antialize at gmail dot com
2015-08-14 17:01 ` [Bug libstdc++/67212] " timshen at gcc dot gnu.org
2015-08-14 17:54 ` timshen at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).