This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] Fix some 28_regex/ fallout
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, libstdc++ at gcc dot gnu dot org
- Date: Wed, 3 Dec 2014 16:47:05 +0100
- Subject: [PATCH] Fix some 28_regex/ fallout
- Authentication-results: sourceware.org; auth=none
This fixes some testsuite fallout in 28_regex/. The problem was that
with -m32 we were triggering UB in a shift. Fixed by multiplying the
RHS of the shift-expression by 0 if we are not going to use the cache.
Regtested/bootstrapped on ppc64-linux, ok for trunk?
2014-12-03 Marek Polacek <polacek@redhat.com>
* include/bits/regex_compiler.h (_S_cache_size): Multiply the
RHS of the shift-expression by _UseCache::value.
diff --git gcc/include/bits/regex_compiler.h gcc/include/bits/regex_compiler.h
index d8880cc..2b2b8e0 100644
--- gcc/include/bits/regex_compiler.h
+++ gcc/include/bits/regex_compiler.h
@@ -417,7 +417,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename std::is_same<_CharT, char>::type _UseCache;
static constexpr size_t
- _S_cache_size() { return 1ul << (sizeof(_CharT) * __CHAR_BIT__); }
+ _S_cache_size() { return 1ul << (sizeof(_CharT) * __CHAR_BIT__
+ * int(_UseCache::value)); }
struct _Dummy { };
typedef typename std::conditional<_UseCache::value,
Marek