This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Detect UB in shifts in constexpr functions


On Wed, Dec 03, 2014 at 02:45:50PM +0100, Andreas Schwab wrote:
> Marek Polacek <polacek@redhat.com> writes:
> 
> > 	* constexpr.c (cxx_eval_check_shift_p): New function.
> > 	(cxx_eval_binary_expression): Call it.  Set NON_CONSTANT_P if it
> > 	returns true.
> >
> > 	* g++.dg/cpp0x/constexpr-shift1.C: New test.
> > 	* g++.dg/cpp1y/constexpr-shift1.C: New test.
> > 	* g++.dg/ubsan/pr63956.C: Add dg-errors.
> 
> FAIL: 28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc (test for excess errors)
> Excess errors:
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:424:31:   in constexpr expansion of 'std::__detail::_BracketMatcher< <template-parameter-1-1>, <anonymous>, <anonymous> >::_S_cache_size<std::regex_traits<wchar_t>, false, false>()'
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:425:20: error: right operand of shift expression '(1ul << 32u)' is >= than the precision of the left operand
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:424:31:   in constexpr expansion of 'std::__detail::_BracketMatcher< <template-parameter-1-1>, <anonymous>, <anonymous> >::_S_cache_size<std::regex_traits<wchar_t>, false, true>()'
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:425:20: error: right operand of shift expression '(1ul << 32u)' is >= than the precision of the left operand
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:424:31:   in constexpr expansion of 'std::__detail::_BracketMatcher< <template-parameter-1-1>, <anonymous>, <anonymous> >::_S_cache_size<std::regex_traits<wchar_t>, true, false>()'
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:425:20: error: right operand of shift expression '(1ul << 32u)' is >= than the precision of the left operand
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:424:31:   in constexpr expansion of 'std::__detail::_BracketMatcher< <template-parameter-1-1>, <anonymous>, <anonymous> >::_S_cache_size<std::regex_traits<wchar_t>, true, true>()'
> /daten/aranym/gcc/gcc-20141203/Build/m68k-linux/libstdc++-v3/include/bits/regex_compiler.h:425:20: error: right operand of shift expression '(1ul << 32u)' is >= than the precision of the left operand

Should be fixed now.

	Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]