public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour
@ 2014-04-24 20:46 hstong at ca dot ibm.com
  2014-04-25  9:36 ` [Bug libstdc++/60958] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hstong at ca dot ibm.com @ 2014-04-24 20:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60958

            Bug ID: 60958
           Summary: Initialization of arrays in tr1/regex ill-formed or
                    with undefined behaviour
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com

The header tr1/regex contains code which is either ill-formed or has undefined
behaviour.
Various C++ language tools choke on this file because of the code in question.

In particular, C++03 subclause 8.5 [dcl.init] does not specify the semantics of
the array initializations in question and they are ill-formed under C++11.



/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/include/c++/tr1/regex:685:22: error: array
      initializer must be an initializer list
   const char* const __wb[] = "w";
                     ^
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/include/c++/tr1/regex:695:22: error: array
      initializer must be an initializer list
   const char* const __bb[] = "blank";
                     ^


VERSION INFO:
$ g++ --version
g++ (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


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

* [Bug libstdc++/60958] Initialization of arrays in tr1/regex ill-formed or with undefined behaviour
  2014-04-24 20:46 [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour hstong at ca dot ibm.com
@ 2014-04-25  9:36 ` redi at gcc dot gnu.org
  2014-04-25 13:27 ` hstong at ca dot ibm.com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-25  9:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60958

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, I have a patch for this somewhere, but why are you including <tr1/regex>
anyway? It's completely useless and doesn't work.


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

* [Bug libstdc++/60958] Initialization of arrays in tr1/regex ill-formed or with undefined behaviour
  2014-04-24 20:46 [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour hstong at ca dot ibm.com
  2014-04-25  9:36 ` [Bug libstdc++/60958] " redi at gcc dot gnu.org
@ 2014-04-25 13:27 ` hstong at ca dot ibm.com
  2014-04-25 15:42 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hstong at ca dot ibm.com @ 2014-04-25 13:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60958

--- Comment #2 from Hubert Tong <hstong at ca dot ibm.com> ---
(In reply to Jonathan Wakely from comment #1)
> Yes, I have a patch for this somewhere, but why are you including
> <tr1/regex> anyway? It's completely useless and doesn't work.

I am trying to use a code base which used a TR1 regex implementation on another
platform. Your comment led me to find
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr1,
which does indicate that tr1/regex does not work. Is the recommendation (short
of switching over to C++11) to use the Boost implementation? Is the TR1
implementation status of regex in libstdc++ likely to change in the future?


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

* [Bug libstdc++/60958] Initialization of arrays in tr1/regex ill-formed or with undefined behaviour
  2014-04-24 20:46 [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour hstong at ca dot ibm.com
  2014-04-25  9:36 ` [Bug libstdc++/60958] " redi at gcc dot gnu.org
  2014-04-25 13:27 ` hstong at ca dot ibm.com
@ 2014-04-25 15:42 ` redi at gcc dot gnu.org
  2014-04-25 16:11 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-25 15:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60958

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Hubert Tong from comment #2)
> I am trying to use a code base which used a TR1 regex implementation on
> another platform. Your comment led me to find
> http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr1,
> which does indicate that tr1/regex does not work.

It's incomplet and incorrekt. Even with those array initializers fixed that
function tries to call a non-existent std::ctype::isspace() function and does
(__f | __wt) when it should be (__f & __wt), and only works for char not
wchar_t, and probably other issues.

> Is the recommendation
> (short of switching over to C++11) to use the Boost implementation? Is the
> TR1 implementation status of regex in libstdc++ likely to change in the
> future?

The TR1 code in libstdc++ is not going to change, so if Boost is an option then
yes, use that.


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

* [Bug libstdc++/60958] Initialization of arrays in tr1/regex ill-formed or with undefined behaviour
  2014-04-24 20:46 [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour hstong at ca dot ibm.com
                   ` (2 preceding siblings ...)
  2014-04-25 15:42 ` redi at gcc dot gnu.org
@ 2014-04-25 16:11 ` redi at gcc dot gnu.org
  2014-04-25 16:13 ` redi at gcc dot gnu.org
  2014-04-28 15:14 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-25 16:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60958

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Apr 25 16:10:25 2014
New Revision: 209807

URL: http://gcc.gnu.org/viewcvs?rev=209807&root=gcc&view=rev
Log:
    PR libstdc++/60958
    * include/tr1/regex (regex_traits::isctype): Comment out broken code.
    * testsuite/util/testsuite_regex.h (regex_match_debug): Improve
    comment.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/tr1/regex
    trunk/libstdc++-v3/testsuite/util/testsuite_regex.h


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

* [Bug libstdc++/60958] Initialization of arrays in tr1/regex ill-formed or with undefined behaviour
  2014-04-24 20:46 [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour hstong at ca dot ibm.com
                   ` (3 preceding siblings ...)
  2014-04-25 16:11 ` redi at gcc dot gnu.org
@ 2014-04-25 16:13 ` redi at gcc dot gnu.org
  2014-04-28 15:14 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-25 16:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60958

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.10.0

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
"Fixed" on trunk (by using #if 0 around the offending code)


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

* [Bug libstdc++/60958] Initialization of arrays in tr1/regex ill-formed or with undefined behaviour
  2014-04-24 20:46 [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour hstong at ca dot ibm.com
                   ` (4 preceding siblings ...)
  2014-04-25 16:13 ` redi at gcc dot gnu.org
@ 2014-04-28 15:14 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-28 15:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60958

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

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 60987 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2014-04-28 15:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 20:46 [Bug libstdc++/60958] New: Initialization of arrays in tr1/regex ill-formed or with undefined behaviour hstong at ca dot ibm.com
2014-04-25  9:36 ` [Bug libstdc++/60958] " redi at gcc dot gnu.org
2014-04-25 13:27 ` hstong at ca dot ibm.com
2014-04-25 15:42 ` redi at gcc dot gnu.org
2014-04-25 16:11 ` redi at gcc dot gnu.org
2014-04-25 16:13 ` redi at gcc dot gnu.org
2014-04-28 15:14 ` 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).