public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/111129] std::regex incorrectly matches quantifiers with plus appended
Date: Thu, 24 Aug 2023 15:16:12 +0000	[thread overview]
Message-ID: <bug-111129-4-ErLkBCHygz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111129-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timshen at gcc dot gnu.org

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This changed with r0-127716-g053eb1f31ede72

            * include/bits/regex_compiler.h (_Comipler<>::_M_quantifier()):
            Fix parse error of multiple consecutive quantifiers like "a**".
            * include/bits/regex_compiler.tcc (_Comipler<>::_M_quantifier()):
            Likewise.
            * testsuite/28_regex/basic_regex/multiple_quantifiers.cc: New.

That added the following tests:

  regex re1("a++");
  regex re2("(a+)+");

The second one is fine, but the first is invalid. The "a**" case mentioned in
the commit message is invalid too.

I don't know why Tim wanted to accept the first one. ECMAscript and POSIX don't
accept it. My GNU grep does, but I think that's just a bug in glibc's regcomp:
https://sourceware.org/bugzilla/show_bug.cgi?id=20095

  parent reply	other threads:[~2023-08-24 15:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 11:37 [Bug libstdc++/111129] New: " gcc at octaforge dot org
2023-08-24 12:22 ` [Bug libstdc++/111129] " redi at gcc dot gnu.org
2023-08-24 15:16 ` redi at gcc dot gnu.org [this message]
2023-08-31  9:24 ` redi at gcc dot gnu.org
2023-10-07 11:32 ` 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-111129-4-ErLkBCHygz@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).