public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "costamagnagianfranco at yahoo dot it" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/112680] New: g++-13 segfault on std::regex_match with c++11 or above -O2 and lto
Date: Thu, 23 Nov 2023 13:38:41 +0000	[thread overview]
Message-ID: <bug-112680-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2023-11-23 13:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 13:38 costamagnagianfranco at yahoo dot it [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112680-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).