[Boost-bugs] [Boost C++ Libraries] #9260: Phoenix switch_ statements accessing wrong memory and cause segfault

Subject: [Boost-bugs] [Boost C++ Libraries] #9260: Phoenix switch_ statements accessing wrong memory and cause segfault
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-18 07:46:19


#9260: Phoenix switch_ statements accessing wrong memory and cause segfault
------------------------------+--------------------------------
 Reporter: stephan.menzel@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.54.0
 Severity: Problem | Keywords: phoenix spirit qi
------------------------------+--------------------------------
 Seth Heeren and I tracked down a problem in phoenix 3's switch_ statements
 that causes a crash in the attached example.

 Judging from valgrind outputs, it appears as if the switch_ accesses
 memory outside it's stack. In the attached case that causes a crash when
 accessing local variables in the enclosing rule.

 To reproduce:

 With this rule:
 qi::rule<It, bool(), qi::locals<bool, unsigned int, double, std::string>,
 Skipper> enclosing;

 defined as:
 enclosing %= condition[_a = _1] >> double_[_val = _a];

 it works.

 If it is defined as:
 enclosing %= condition[_a = _1] >> double_[_c = _1, _val = _a];

 it crashes.

 When not using local variables there is no crash but still undefined
 behavior caused by the switch_.
 Phoenix 2 does not have this problem.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9260>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC