Tim Shen | 27 Aug 03:41 2015

[Patch, libstdc++/67362] Fix non-special character for POSIX basic syntax in regex

Bootstrapped and tested on x86_64-pc-linux-gnu.


Tim Shen
commit e134e1a835ad15900686351cade36774593b91ea
Author: Tim Shen <timshen <at> google.com>
Date:   Wed Aug 26 17:51:29 2015 -0700

    	PR libstdc++/67362
    	* include/bits/regex_scanner.tcc (_Scanner<>::_M_scan_normal):
    	Always returns ordinary char token if the char isn't
    	considered a special char.
    	* testsuite/28_regex/regression.cc: New test file for collecting
    	regression testcases from, typically, bugzilla.

diff --git a/libstdc++-v3/include/bits/regex_scanner.tcc b/libstdc++-v3/include/bits/regex_scanner.tcc
index 3bcbd0f..1555669 100644
--- a/libstdc++-v3/include/bits/regex_scanner.tcc
+++ b/libstdc++-v3/include/bits/regex_scanner.tcc
 <at>  <at>  -99,6 +99,12  <at>  <at>  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       auto __c = *_M_current++;
       const char* __pos;

+      if (std::strchr(_M_spec_char, _M_ctype.narrow(__c, '\0')) == nullptr)
+	{
(Continue reading)

Jonathan Wakely | 26 Aug 16:54 2015

[patch] libstdc++/64351 Ensure std::generate_canonical doesn't return 1.

Ed posted this patch to https://gcc.gnu.org/PR64351 in January, I've
tested it and am committing it to trunk with a test.

Attachment (patch.txt): text/x-patch, 3632 bytes
Jonathan Wakely | 24 Aug 15:46 2015

[patch] libstdc++/65049 Fix undefined behaviour in char_traits

char_traits must not pass null pointers to memove, memcmp etc.

Tested powerpc64le-linux, committed to trunk.

This should probably go on the 5 and 4.9 branches too.
Attachment (patch.txt): text/x-patch, 12 KiB
Jonathan Wakely | 20 Aug 22:36 2015

[patch] libstdc++/67294 Don't run timed mutex tests on Darwin

I added these tests recently but Darwin doesn't support timed mutexes.

Tested powerpc64le-linux, committed to trunk.

Attachment (patch.txt): text/x-patch, 2352 bytes
Fan You | 19 Aug 07:44 2015

[GSoC] Compiler support for invocation_type


I'm working on implementing invocation_type

However, I find it hard to get the matched invocation parameter of
function F by specialization and SFINAE.

For example:

int f(const char*);
int f(int);

How can I get the invocation parameter of INVOKE(f, "abc")? which
should be (const char*).

I saw invocation_type is a compiler-supported type, but I don't know
how to make use of the compiler to achieve this.




Jonathan Wakely | 18 Aug 19:57 2015

Regenerated libstdc++-v3/* with automake-1.11.6

I need to make some changes to src/Makefile.am on the gcc-5-branch so
this regenerates everything with automake-1.11.6 first.

Tested powerpc64le-linux, committed to gcc-5-branch.

    	* Makefile.in: Regenerate with automake-1.11.6.
    	* aclocal.m4: Likewise.
    	* configure: Likewise.
    	* doc/Makefile.in: Likewise.
    	* include/Makefile.in: Likewise.
    	* libsupc++/Makefile.in: Likewise.
    	* po/Makefile.in: Likewise.
    	* python/Makefile.in: Likewise.
    	* src/Makefile.in: Likewise.
    	* src/c++11/Makefile.in: Likewise.
    	* src/c++98/Makefile.in: Likewise.
    	* testsuite/Makefile.in: Likewise.

(No patch as these are all generated by automake.)

Jonathan Wakely | 18 Aug 14:41 2015

[patch] Alter libstdc++ test to work after c++/67216 fix

With Paolo's fix the use of the safe-bool idiom in this test no longer
compiles in C++11 or C++14. The requirement in TR1 is that it works
"in a boolean context" and p1 == false is not necessarily a boolean
context. Do an explicit conversion to make it valid in all modes.

Tested powerpc64le-linux, committing to trunk.
Attachment (patch.txt): text/x-patch, 954 bytes
Jonathan Wakely | 18 Aug 14:39 2015

[v3 patch] Fix header included by <bits/ptr_traits.h>

While trying some header rearrangment I noticed that this file should
include <bits/move.h> for addressof.

Tested powerpc64le-linux, committing to trunk.
Attachment (patch.txt): text/x-patch, 565 bytes
Tim Shen | 15 Aug 20:49 2015

Handling stack overflow in <regex>


Currently we got 3 bugs about stack overflow due to the deep recursion
<regex> loads.

Boost specifically implemented a non-recursive engine, which manually
maintain a heap allocated C++ container as a storage stack to
implement backtracking. The disadvantages are 1) less readable code,
and 2) less efficient code, since manual stack can't benefit from
compiler optimizations (e.g. inlining) as much.

I assume libgcc is a mandatory dependency of libstdc++, since
std::thread uses gthr.h.

I propose to use POSIX makecontext-like semantic to create a new fixed
configurable sized stack, and run the same recursive code on this
stack happily ever after :). When this stack is exhausted (we can
periodically check the stack consumption in regex), throw a

I find context switching related code in libgcc's generic-morestack.c.
It targets -fsplit-stack, but split stack is just too heavy for us. I
plan to pull out makecontext/swapcontext primitives and use them

I don't know if POSIX makecontext/swapcontext is a choice, but that is
less efficient and deprecated
and boost implements its own.

(Continue reading)

Florian Weimer | 14 Aug 19:49 2015

Alleged libstdc++ vulnerabilities

Does anybody know what this is about and can point to the relevant PRs?

“discovered serious security bugs in […] libstdc++”


The USENIX paper
does not back up this claim.


Florian Weimer / Red Hat Product Security

Ed Smith-Rowland | 13 Aug 16:37 2015

[v3 PATCH] Add C++11 <cuchar>


Now that most systems have uchar.h for conversion between char16_t* and 
char32_t* to multibyte (analogue of wchar.h and cwchar) i think we 
should check off this last little crumb of C++11.

I submitted this a while back but Jonathan suggested improvements and it 
took me a hot minute to wade through autohell.

Built and tested clean on x86_64-linux.


2015-08-13  Edward Smith-Rowland  <3dw4rd <at> verizon.net>

	Add C++11 header <cuchar>.
	* acinclude.m4: Regenerate.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for <uchar.h>.
	* include/Makefile.am: Check for <uchar.h>.
	* include/Makefile.in: Regenerate.
	* include/c/cuchar: New.
	* include/c_compatibility/uchar.h: New.
	* include/c_global/cuchar: New.
	* include/c_std/cuchar: New.
	* include/precompiled/stdc++.h: Include <cuchar>.
	* testsuite/17_intro/headers/c++200x/stdc++.cc: Include <uchar.h>.
(Continue reading)