Modify

Ticket #2655 (closed Support Requests: fixed)

Opened 5 years ago

Last modified 4 years ago

pure virtual function called under gcc -O2

Reported by: eherbst@… Owned by: eric_niebler
Milestone: Boost 1.38.0 Component: xpressive
Version: Boost 1.37.0 Severity: Problem
Keywords: Cc:

Description

The following code results in a pure virtual function call under gcc-4.3.0 20080428 (red hat 4.3.0-8) with -O2 but not with -O1. The innermost non-error-handling stack frame gdb shows is

boost::xpressive::detail::end_matcher::match<gnu_cxx::normal_iterator<char const*, std::string>, boost::xpressive::detail::no_next>

at boost/xpressive/detail/core/flow_control.hpp:64.

--- #include <string> #include <boost/xpressive/xpressive_static.hpp> #include <boost/xpressive/regex_algorithms.hpp> using std::string; namespace xpr = boost::xpressive;

int main() {

string text = "at"; xpr::sregex r1 = xpr::as_xpr('a'),

r2 = 'b' >> r1, r3 = r2 | r1;

xpr::regex_replace(text, r3, string("")); return 0;

} ---

The problem goes away if I do any one of these:

  • switch the order of the alternation
  • replace 'r1' in the definition of r3 with xpr::as_xpr('a')
  • replace 'r2' in the definition of r3 with ('b' >> r1)
  • match to a string not starting with 'a'

It does not go away if I do one of these:

  • change the 'b' in r2 to 'a'
  • stick a by_ref() around r1 in the definition of r2

Any ideas?

Thank you.

Attachments

Change History

comment:1 Changed 5 years ago by eric_niebler

  • Status changed from new to assigned

I can confirm this error with gcc-4.3 and gcc-4.2 but not gcc-4.1 or msvc-9.0. It seems likely to be a gcc optimization bug, but I don't have time to investigate right now. I'll get to it as time allows.

comment:2 Changed 5 years ago by eric_niebler

I've filed a gcc bug. Still looking for a work-around and can use the help of a very good gcc debugging guru.

 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39509

comment:3 Changed 5 years ago by eric_niebler

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [51863]) work around gcc optimizer bug fixes #2655

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.