This is the mail archive of the gcc-bugs@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]

[Bug c++/70139] New: -fno-ellide-constructor makes static std::regex to throw


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

            Bug ID: 70139
           Summary: -fno-ellide-constructor makes static std::regex to
                    throw
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ostash at ostash dot kiev.ua
  Target Milestone: ---

Following code:

#include <regex>

namespace
{
  const std::regex HTTP_START_HEADER_RE("^HTTP\\/\\d.\\d\\s+(\\d+)\\s+([\\w\\t
]+)\\r\\n");
}

int main()
{
}

compiles and works perfectly with GCC 4.9 with and without
-fno-ellide-constructor.


However, with GCC 5.3.1 20160216 and with -fno-ellide-constructor it got
aborted due to exception:

terminate called after throwing an instance of 'std::regex_error'
  what():  regex_error

GDB backtrace:

(gdb) bt
#0  0x0000003ceb632625 in raise () from /lib64/libc.so.6
#1  0x0000003ceb633e05 in abort () from /lib64/libc.so.6
#2  0x00007ffff7cbda2d in __gnu_cxx::__verbose_terminate_handler() () from
gcc5/lib/libstdc++.so.6
#3  0x00007ffff7cbba86 in ?? () from gcc5/lib/libstdc++.so.6
#4  0x00007ffff7cbbad1 in std::terminate() () from gcc5/lib/libstdc++.so.6
#5  0x00007ffff7cbbce8 in __cxa_throw () from gcc5/lib/libstdc++.so.6
#6  0x00007ffff7ce4635 in
std::__throw_regex_error(std::regex_constants::error_type) ()
fromgcc5/lib/libstdc++.so.6
#7  0x00000000004085bb in
std::__detail::_BracketMatcher<std::regex_traits<char>, false,
false>::_M_add_character_class (this=0x7fffffffd920, __s=..., __neg=<optimized
out>)
    at gcc5/include/c++/5.3.1/bits/regex_compiler.h:431
#8  0x000000000040c580 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_expression_term<false, false> (this=this@entry=0x7fffffffe280,
__last_char=..., __matcher=...)
    at gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:507
#9  0x000000000040e1a2 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_insert_bracket_matcher<false, false> (this=this@entry=0x7fffffffe280,
__neg=<optimized out>)
    at gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:427
#10 0x000000000040f796 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_bracket_expression (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:355
#11 0x0000000000410ec6 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_atom (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:341
#12 0x00000000004113f8 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_term (this=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:139
#13 std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative
(this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:121
#14 0x0000000000411559 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_disjunction (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:97
#15 0x00000000004110a6 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_atom (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:334
#16 0x00000000004113f8 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_term (this=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:139
#17 std::__detail::_Compiler<std::regex_traits<char> >::_M_alternative
(this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:121
#18 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#19 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#20 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#21 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#22 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#23 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#24 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#25 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#26 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#27 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#28 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#29 0x0000000000411364 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_alternative (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:124
#30 0x0000000000411559 in std::__detail::_Compiler<std::regex_traits<char>
>::_M_disjunction (this=this@entry=0x7fffffffe280) at
gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:97
#31 0x0000000000411d44 in std::__detail::_Compiler<std::regex_traits<char>
>::_Compiler (this=0x7fffffffe280, __b=<optimized out>, __e=<optimized out>,
__loc=..., __flags=<optimized out>)
    at gcc5/include/c++/5.3.1/bits/regex_compiler.tcc:82
#32 0x0000000000411f25 in std::__detail::__compile_nfa<char const*,
std::regex_traits<char> > (__first=__first@entry=0x4129a0
"^HTTP\\/\\d.\\d\\s+(\\d+)\\s+([\\w\\t ]+)\\r\\n", __last=__last@entry=0x4129c5
"", __loc=...,
    __flags=<optimized out>) at
gcc5/include/c++/5.3.1/bits/regex_compiler.h:194
#33 0x0000000000401ce3 in std::basic_regex<char, std::regex_traits<char>
>::basic_regex<char const*> (__f=(unknown: 16), __loc=..., __last=0x4129c5 "",
__first=0x4129a0 "^HTTP\\/\\d.\\d\\s+(\\d+)\\s+([\\w\\t ]+)\\r\\n",
    this=0x616d20 <(anonymous namespace)::HTTP_START_HEADER_RE>) at
gcc5/include/c++/5.3.1/bits/regex.h:767
#34 std::basic_regex<char, std::regex_traits<char> >::basic_regex<char const*>
(__f=(unknown: 16), __last=0x4129c5 "", __first=0x4129a0
"^HTTP\\/\\d.\\d\\s+(\\d+)\\s+([\\w\\t ]+)\\r\\n",
    this=0x616d20 <(anonymous namespace)::HTTP_START_HEADER_RE>) at
gcc5/include/c++/5.3.1/bits/regex.h:512
#35 std::basic_regex<char, std::regex_traits<char> >::basic_regex
(__f=(unknown: 16), __p=0x4129a0 "^HTTP\\/\\d.\\d\\s+(\\d+)\\s+([\\w\\t
]+)\\r\\n", this=0x616d20 <(anonymous namespace)::HTTP_START_HEADER_RE>)
    at gcc5/include/c++/5.3.1/bits/regex.h:445
#36 __static_initialization_and_destruction_0 (__initialize_p=1,
__priority=65535) at regex.cpp:5
#37 _GLOBAL__sub_I_main () at regex.cpp:11
#38 0x000000000041260d in __libc_csu_init ()
#39 0x0000003ceb61ecf0 in __libc_start_main () from /lib64/libc.so.6
#40 0x0000000000401d79 in _start ()


Still works well without -fno-ellide-constructor.

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