From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21666 invoked by alias); 26 Mar 2012 08:28:50 -0000 Received: (qmail 21656 invoked by uid 22791); 26 Mar 2012 08:28:49 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Mar 2012 08:28:33 +0000 From: "rleigh at debian dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/52719] New: C++11 std::regex is broken compiling simple regular expressions Date: Mon, 26 Mar 2012 08:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rleigh at debian dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg02201.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52719 Bug #: 52719 Summary: C++11 std::regex is broken compiling simple regular expressions Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: rleigh@debian.org Created attachment 26991 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26991 Working code using boost::regex This is reproducible with both GCC 4.6 and 4.7. Simple expressions such as "^[^:/,.][^:/,]*$" result in a regex_error exception being thrown. The exception what() method returns only "regex_error", rather than any informative message. The code previously used boost::regex, which worked perfectly well. The same regex also works with grep. I've attached: - working boost code - failing std::regex code - compiler info - g++ -E output The gdb backtrace is as follows: % gdb testr GNU gdb (GDB) 7.4-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /home/rleigh/schroot/testr...(no debugging symbols found)...done. (gdb) catch throw Function "__cxa_throw" not defined. Catchpoint 1 (throw) (gdb) run Starting program: /home/rleigh/schroot/testr Catchpoint 1 (exception thrown), 0x000000319f862800 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (gdb) bt #0 0x000000319f862800 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x000000319f8b5a9d in std::__throw_regex_error(std::regex_constants::error_type) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #2 0x0000000000408bac in std::__regex::_Compiler >::_M_bracket_expression() () #3 0x0000000000407db3 in std::__regex::_Compiler >::_M_atom() () #4 0x0000000000406db5 in std::__regex::_Compiler >::_M_term() () #5 0x0000000000405a28 in std::__regex::_Compiler >::_M_alternative() () #6 0x0000000000405a72 in std::__regex::_Compiler >::_M_alternative() () #7 0x0000000000404d38 in std::__regex::_Compiler >::_M_disjunction() () #8 0x00000000004042ed in std::__regex::_Compiler >::_Compiler(char const* const&, char const* const&, std::regex_traits&, unsigned int) () #9 0x00000000004037e9 in std::shared_ptr std::__regex::__compile >(char const* const&, char const* const&, std::regex_traits&, unsigned int) () #10 0x0000000000402e89 in std::basic_regex >::basic_regex(char const*, unsigned int) () #11 0x0000000000401b16 in main ()