public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112680] New: g++-13 segfault on std::regex_match with c++11 or above -O2 and lto
@ 2023-11-23 13:38 costamagnagianfranco at yahoo dot it
  2023-11-23 15:04 ` [Bug lto/112680] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: costamagnagianfranco at yahoo dot it @ 2023-11-23 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112680
           Summary: g++-13 segfault on std::regex_match with c++11 or
                    above -O2 and lto
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: costamagnagianfranco at yahoo dot it
  Target Milestone: ---

Created attachment 56672
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56672&action=edit
reproduce test case

This used to work with g++-10 and started to fail with g++-11 g++-12 and g++-13
sh runme.sh 
Segmentation fault (core dumped)


g++-12 main.cpp -std=c++11 -O2 -flto=auto -o main && ./main

The main is really simple, load two strings, and call regex function

#include <fstream>
#include <sstream>
#include <iostream>
#include <regex>
int main()
{
std::ifstream t("file.txt");
std::stringstream file;
file << t.rdbuf();
std::string filestr = file.str();

std::ifstream t2("regex.txt");
std::stringstream filepathregex;
filepathregex << t2.rdbuf();
std::string regexstr = filepathregex.str();

const std::regex regex(regexstr);
std::regex_match(filestr.begin(), filestr.end(), regex);
}

I attached the tarball with the files to reproduce the issue.


The content triggering the issue was originated by the testsuite dump of
zim-tools
https://launchpad.net/ubuntu/+source/zim-tools/3.2.0-1build1

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

* [Bug lto/112680] g++-13 segfault on std::regex_match with c++11 or above -O2 and lto
  2023-11-23 13:38 [Bug c++/112680] New: g++-13 segfault on std::regex_match with c++11 or above -O2 and lto costamagnagianfranco at yahoo dot it
@ 2023-11-23 15:04 ` redi at gcc dot gnu.org
  2023-11-23 15:07 ` [Bug c++/112680] " redi at gcc dot gnu.org
  2023-11-23 15:08 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-23 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2023-11-23
          Component|c++                         |lto

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

* [Bug c++/112680] g++-13 segfault on std::regex_match with c++11 or above -O2 and lto
  2023-11-23 13:38 [Bug c++/112680] New: g++-13 segfault on std::regex_match with c++11 or above -O2 and lto costamagnagianfranco at yahoo dot it
  2023-11-23 15:04 ` [Bug lto/112680] " redi at gcc dot gnu.org
@ 2023-11-23 15:07 ` redi at gcc dot gnu.org
  2023-11-23 15:08 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-23 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|lto                         |c++

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
ASan shows there's a stack overflow, even without -flto=auto

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

* [Bug c++/112680] g++-13 segfault on std::regex_match with c++11 or above -O2 and lto
  2023-11-23 13:38 [Bug c++/112680] New: g++-13 segfault on std::regex_match with c++11 or above -O2 and lto costamagnagianfranco at yahoo dot it
  2023-11-23 15:04 ` [Bug lto/112680] " redi at gcc dot gnu.org
  2023-11-23 15:07 ` [Bug c++/112680] " redi at gcc dot gnu.org
@ 2023-11-23 15:08 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-23 15:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |102445

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It could just be the well known problem of resource exhaustion with our
recursive std::regex implementation.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102445
[Bug 102445] [meta-bug] std::regex issues

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

end of thread, other threads:[~2023-11-23 15:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23 13:38 [Bug c++/112680] New: g++-13 segfault on std::regex_match with c++11 or above -O2 and lto costamagnagianfranco at yahoo dot it
2023-11-23 15:04 ` [Bug lto/112680] " redi at gcc dot gnu.org
2023-11-23 15:07 ` [Bug c++/112680] " redi at gcc dot gnu.org
2023-11-23 15:08 ` redi 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).