public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
@ 2015-07-26  8:40 doko at gcc dot gnu.org
  2015-07-26  8:41 ` [Bug libstdc++/67015] " doko at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: doko at gcc dot gnu.org @ 2015-07-26  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67015
           Summary: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is
                    miscompiled
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

Created attachment 36055
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36055&action=edit
regex.cc

[forwarded from https://bugs.debian.org/778112]

This regex is failing:

  std::regex("^[a-z0-9][a-z0-9-]*$", std::regex::extended);

however this one works:

  std::regex("^[a-z0-9][-a-z0-9]*$", std::regex::extended); 

I'm unable to reproduce the claim in the original bug report with regex2.cc.

$ cat run.sh 
g++-4.8 -static-libstdc++ -std=c++0x regex.cc && ./a.out
g++-4.9 -static-libstdc++ -std=c++0x regex.cc && ./a.out
g++-5 -static-libstdc++ -std=c++0x regex.cc && ./a.out
/usr/lib/gcc-snapshot/bin/g++ -static-libstdc++ -std=c++0x regex.cc && ./a.out
clang++-3.5 -stdlib=libc++ -std=c++0x regex.cc && ./a.out
clang++-3.6 -stdlib=libc++ -std=c++0x regex.cc && ./a.out

g++-4.8 -static-libstdc++ -std=c++0x regex2.cc && ./a.out
g++-4.9 -static-libstdc++ -std=c++0x regex2.cc && ./a.out
g++-5 -static-libstdc++ -std=c++0x regex2.cc && ./a.out
/usr/lib/gcc-snapshot/bin/g++ -static-libstdc++ -std=c++0x regex2.cc && ./a.out
clang++-3.5 -stdlib=libc++ -std=c++0x regex2.cc && ./a.out
clang++-3.6 -stdlib=libc++ -std=c++0x regex2.cc && ./a.out

+ g++-4.8 -static-libstdc++ -std=c++0x regex.cc
+ ./a.out
E0: regex_error
a.out: regex.cc:24: int main(): Assertion `std::regex_match("test",
debian_cron_namespace)' failed.
Aborted (core dumped)
+ g++-4.9 -static-libstdc++ -std=c++0x regex.cc
+ ./a.out
E1: regex_error
+ g++-5 -static-libstdc++ -std=c++0x regex.cc
+ ./a.out
E1: regex_error
+ /usr/lib/gcc-snapshot/bin/g++ -static-libstdc++ -std=c++0x regex.cc
+ ./a.out
E1: regex_error
+ clang++-3.5 -stdlib=libc++ -std=c++0x regex.cc
+ ./a.out
+ clang++-3.6 -stdlib=libc++ -std=c++0x regex.cc
+ ./a.out
+ g++-4.8 -static-libstdc++ -std=c++0x regex2.cc
+ ./a.out
E0: regex_error
E1: regex_error
E2: regex_error
+ g++-4.9 -static-libstdc++ -std=c++0x regex2.cc
+ ./a.out
+ g++-5 -static-libstdc++ -std=c++0x regex2.cc
+ ./a.out
+ /usr/lib/gcc-snapshot/bin/g++ -static-libstdc++ -std=c++0x regex2.cc
+ ./a.out
+ clang++-3.5 -stdlib=libc++ -std=c++0x regex2.cc
+ ./a.out
+ clang++-3.6 -stdlib=libc++ -std=c++0x regex2.cc
+ ./a.out


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
@ 2015-07-26  8:41 ` doko at gcc dot gnu.org
  2015-07-26 10:05 ` rleigh at debian dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: doko at gcc dot gnu.org @ 2015-07-26  8:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Matthias Klose <doko at gcc dot gnu.org> ---
Created attachment 36056
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36056&action=edit
regex2.cc


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
  2015-07-26  8:41 ` [Bug libstdc++/67015] " doko at gcc dot gnu.org
@ 2015-07-26 10:05 ` rleigh at debian dot org
  2015-07-27 11:31 ` doko at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rleigh at debian dot org @ 2015-07-26 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Roger Leigh <rleigh at debian dot org> ---
Note regex2.cc fails with 4.9.2 but not with 4.9.3 or 5.1, so this appear to
have been fixed.


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
  2015-07-26  8:41 ` [Bug libstdc++/67015] " doko at gcc dot gnu.org
  2015-07-26 10:05 ` rleigh at debian dot org
@ 2015-07-27 11:31 ` doko at gcc dot gnu.org
  2015-07-29  3:46 ` timshen at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: doko at gcc dot gnu.org @ 2015-07-27 11:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Matthias Klose <doko at gcc dot gnu.org> ---
patch posted at
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg02177.html
https://gcc.gnu.org/ml/libstdc++/2015-07/msg00068.html


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-07-27 11:31 ` doko at gcc dot gnu.org
@ 2015-07-29  3:46 ` timshen at gcc dot gnu.org
  2015-07-29  4:31 ` timshen at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-07-29  3:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Wed Jul 29 03:45:35 2015
New Revision: 226336

URL: https://gcc.gnu.org/viewcvs?rev=226336&root=gcc&view=rev
Log:
        PR libstdc++/67015
        * include/bits/regex_compiler.h (_Compiler<>::_M_expression_term,
        _BracketMatcher<>::_M_add_collating_element): Change signature
        to make checking the and of bracket expression easier.
        * include/bits/regex_compiler.tcc (_Compiler<>::_M_expression_term):
        Treat '-' as a valid literal if it's at the end of bracket expression.
        * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
        New testcases.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/regex_compiler.h
    trunk/libstdc++-v3/include/bits/regex_compiler.tcc
   
trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-07-29  3:46 ` timshen at gcc dot gnu.org
@ 2015-07-29  4:31 ` timshen at gcc dot gnu.org
  2015-07-29  4:45 ` timshen at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-07-29  4:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Wed Jul 29 04:30:25 2015
New Revision: 226337

URL: https://gcc.gnu.org/viewcvs?rev=226337&root=gcc&view=rev
Log:
        Backport from mainline
        2015-07-29  Tim Shen  <timshen@google.com>

        PR libstdc++/67015
        * include/bits/regex_compiler.h (_Compiler<>::_M_expression_term,
        _BracketMatcher<>::_M_add_collating_element): Change signature
        to make checking the and of bracket expression easier.
        * include/bits/regex_compiler.tcc (_Compiler<>::_M_expression_term):
        Treat '-' as a valid literal if it's at the end of bracket expression.
        * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
        New testcases.

Modified:
    branches/gcc-5-branch/libstdc++-v3/ChangeLog
    branches/gcc-5-branch/libstdc++-v3/include/bits/regex_compiler.h
    branches/gcc-5-branch/libstdc++-v3/include/bits/regex_compiler.tcc
   
branches/gcc-5-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-07-29  4:31 ` timshen at gcc dot gnu.org
@ 2015-07-29  4:45 ` timshen at gcc dot gnu.org
  2015-07-29  9:34 ` ville.voutilainen at gmail dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-07-29  4:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Tim Shen <timshen at gcc dot gnu.org> ---
Fixed in trunk and gcc5.

Mark as fixed.


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-07-29  4:45 ` timshen at gcc dot gnu.org
@ 2015-07-29  9:34 ` ville.voutilainen at gmail dot com
  2015-07-29 21:26 ` timshen at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-07-29  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ville.voutilainen at gmail dot com

--- Comment #7 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
I think it would be a good idea to backport this fix to 4.9 as well, that
version will be in use out in the wild for quite some time. I'm not hell-bent
on having such a backport, I just think it would seem reasonable.


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-07-29  9:34 ` ville.voutilainen at gmail dot com
@ 2015-07-29 21:26 ` timshen at gcc dot gnu.org
  2015-07-29 23:58 ` ville.voutilainen at gmail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-07-29 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Tim Shen <timshen at gcc dot gnu.org> ---
(In reply to Ville Voutilainen from comment #7)
> I think it would be a good idea to backport this fix to 4.9 as well, that
> version will be in use out in the wild for quite some time. I'm not hell-bent
> on having such a backport, I just think it would seem reasonable.

Well we've decided not to do so...
https://gcc.gnu.org/ml/libstdc++/2015-07/msg00083.html

But to be honest I have no idea of the user side. So I'll leave this to
Jonathan. BTW, backporting takes trivial effort.


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-07-29 21:26 ` timshen at gcc dot gnu.org
@ 2015-07-29 23:58 ` ville.voutilainen at gmail dot com
  2015-07-31 22:31 ` i.zaufi at gmail dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-07-29 23:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
(In reply to Tim Shen from comment #8)
> Well we've decided not to do so...
> https://gcc.gnu.org/ml/libstdc++/2015-07/msg00083.html

Yes, I read that, that's why I commented on this bug, I'd like to
change Jonathan's mind about it. :)


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-07-29 23:58 ` ville.voutilainen at gmail dot com
@ 2015-07-31 22:31 ` i.zaufi at gmail dot com
  2015-08-04  8:57 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: i.zaufi at gmail dot com @ 2015-07-31 22:31 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Turbov <i.zaufi at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |i.zaufi at gmail dot com

--- Comment #10 from Alex Turbov <i.zaufi at gmail dot com> ---
Few more links to think about backporting to 4.9:

https://bugs.gentoo.org/show_bug.cgi?id=555648
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=778112


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2015-08-04  8:57 ` redi at gcc dot gnu.org
@ 2015-08-04  8:57 ` redi at gcc dot gnu.org
  2015-08-05  4:40 ` timshen at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-08-04  8:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
OK, let's backport to 4.9 too.


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2015-07-31 22:31 ` i.zaufi at gmail dot com
@ 2015-08-04  8:57 ` redi at gcc dot gnu.org
  2015-08-04  8:57 ` redi at gcc dot gnu.org
  2015-08-05  4:40 ` timshen at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2015-08-04  8:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.4


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

* [Bug libstdc++/67015] "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled
  2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2015-08-04  8:57 ` redi at gcc dot gnu.org
@ 2015-08-05  4:40 ` timshen at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-08-05  4:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Wed Aug  5 04:39:23 2015
New Revision: 226607

URL: https://gcc.gnu.org/viewcvs?rev=226607&root=gcc&view=rev
Log:
        Backported from mainline
        2015-07-29  Tim Shen  <timshen@google.com>

        PR libstdc++/67015
        * include/bits/regex_compiler.h (_Compiler<>::_M_expression_term,
        _BracketMatcher<>::_M_add_collating_element): Change signature
        to make checking the and of bracket expression easier.
        * include/bits/regex_compiler.tcc (_Compiler<>::_M_expression_term):
        Treat '-' as a valid literal if it's at the end of bracket expression.
        * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
        New testcases.

Modified:
    branches/gcc-4_9-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_9-branch/libstdc++-v3/include/bits/regex_compiler.h
    branches/gcc-4_9-branch/libstdc++-v3/include/bits/regex_compiler.tcc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc


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

end of thread, other threads:[~2015-08-05  4:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-26  8:40 [Bug libstdc++/67015] New: "^[a-z0-9][a-z0-9-]*$", std::regex::extended is miscompiled doko at gcc dot gnu.org
2015-07-26  8:41 ` [Bug libstdc++/67015] " doko at gcc dot gnu.org
2015-07-26 10:05 ` rleigh at debian dot org
2015-07-27 11:31 ` doko at gcc dot gnu.org
2015-07-29  3:46 ` timshen at gcc dot gnu.org
2015-07-29  4:31 ` timshen at gcc dot gnu.org
2015-07-29  4:45 ` timshen at gcc dot gnu.org
2015-07-29  9:34 ` ville.voutilainen at gmail dot com
2015-07-29 21:26 ` timshen at gcc dot gnu.org
2015-07-29 23:58 ` ville.voutilainen at gmail dot com
2015-07-31 22:31 ` i.zaufi at gmail dot com
2015-08-04  8:57 ` redi at gcc dot gnu.org
2015-08-04  8:57 ` redi at gcc dot gnu.org
2015-08-05  4:40 ` 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).