Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #84160

Re: core dumped at regex_search()

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: core dumped at regex_search()
Date 2022-05-18 08:52 +0000
Organization Aioe.org NNTP Server
Message-ID <t62c4r$o85$1@gioia.aioe.org> (permalink)
References <t5l9ts$2rkbj$1@portraits.wsisiz.edu.pl> <t62a71$3oaal$1@portraits.wsisiz.edu.pl>

Show all headers | View raw


Jivanmukta <jivanmukta@poczta.onet.pl> wrote:
> I failed to reproduce problem in isolated test program.
> 
> #include <string>
> #include <iostream>
> #include <fstream>
> #include <regex>
> 
> using namespace std;
> 
> int main() {
>     ifstream in("test.txt" /* very big text file */, std::ifstream::in);
>     string line;
>     in >> line;
>     string regexp1 = 
> "(static|private|protected|public)?\\s*(readonly)?\\s*([_a-zA-Z0-9]+)?\\s*(\\$([a-zA-Z_][a-zA-Z0-9_]*)\\s*=.*,?\\s*)+";
>     regex re1(regexp1, std::regex_constants::icase);
>     smatch matches;
>     if (regex_search(line, matches, re1) && matches.ready()) {
>         cout << "match" << endl;
>     } else {
>        cout << "no match" << endl;
>     }
> }
> 
> Now I am learning valgrind.

Try first compiling with the command-line parameters

  -fsanitize=address -D_GLIBCXX_DEBUG

This is easier because you don't need to learn new things. When you run
the program if the checking code added by those options detects a problem
it will tell where it's happening.

(The advantage of using valgrind is that it will detect even more runtime
errors.)

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

core dumped at regex_search() Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-05-13 11:54 +0200
  Re: core dumped at regex_search() Juha Nieminen <nospam@thanks.invalid> - 2022-05-13 10:20 +0000
    Re: core dumped at regex_search() Juha Nieminen <nospam@thanks.invalid> - 2022-05-13 10:25 +0000
  Re: core dumped at regex_search() Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-05-13 12:47 +0200
  Re: core dumped at regex_search() Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-05-13 14:40 +0200
    Re: core dumped at regex_search() Juha Nieminen <nospam@thanks.invalid> - 2022-05-14 07:18 +0000
  Re: core dumped at regex_search() James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-05-14 01:21 -0400
  Re: core dumped at regex_search() Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-05-18 10:19 +0200
    Re: core dumped at regex_search() Juha Nieminen <nospam@thanks.invalid> - 2022-05-18 08:52 +0000
      Re: core dumped at regex_search() Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-05-18 11:59 +0200
        Re: core dumped at regex_search() Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-05-18 12:58 +0200
          Re: core dumped at regex_search() Juha Nieminen <nospam@thanks.invalid> - 2022-05-19 15:15 +0000
  Re: core dumped at regex_search() Tony Oliver <guinness.tony@gmail.com> - 2022-05-20 07:53 -0700
    Re: core dumped at regex_search() Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-05-22 08:13 +0200

csiph-web