Boost C++ Libraries: Ticket #12624: bug error calling boost::make_u32regex() https://svn.boost.org/trac10/ticket/12624 <p> os: SunOS 5.11 11.2 sun4v sparc sun4v gcc:gcc (GCC) 4.8.2 boost regex:tried 1.59-&gt;1_63+ </p> <p> When calling boost::make_u32regex() with a regex like: '302-Found <br />(<a class="source" href="https://svn.boost.org/trac10/log/?revs=0-9">[0-9]</a>+A<a class="source" href="https://svn.boost.org/trac10/log/?revs=0-9">[0-9]</a>+<br />)' </p> <p> The core occurs: </p> <p> <a class="missing ticket">#0</a> 0x00142854 in boost::re_detail_106300::basic_regex_creator&lt;int, boost::icu_regex_traits&gt;::append_set (this=0xffbfd5b0, char_set=...) at ./boost/regex/v4/basic_regex_creator.hpp:380 380 result-&gt;cclasses = char_set.classes(); </p> <p> I added some debug for char_set, and it was fine. The issue is with result ( boost::re_detail_106300::re_set_long&lt;unsigned long long&gt; *); this structure has 2 long long variables (8byte): cclasses, cnclasses after 3 * 4byte variables (csingles,cranges,cequivalents). </p> <p> from boost/regex/v4/states.hpp, the structure is: </p> <p> 203 /<strong>* struct re_set_long </strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong>* 204 A wide character set of characters, following this structure will be 205 an array of type charT: 206 First csingles null-terminated strings 207 Then 2 * cranges NULL terminated strings 208 Then cequivalents NULL terminated strings 209 <strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong>*/ 210 template &lt;class mask_type&gt; 211 struct re_set_long : public re_syntax_base 212 { 213 unsigned int csingles, cranges, cequivalents; 214 mask_type cclasses; 215 mask_type cnclasses; 216 bool isnot; 217 bool singleton; 218 }; </strong></p> <p> When this struct definition is changed to force alignment: </p> <p> 203 /<strong>* struct re_set_long </strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong>* 204 A wide character set of characters, following this structure will be 205 an array of type charT: 206 First csingles null-terminated strings 207 Then 2 * cranges NULL terminated strings 208 Then cequivalents NULL terminated strings 209 <strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong>*/ 210 template &lt;class mask_type&gt; 211 struct <span class="underline">attribute</span>((<span class="underline">packed</span>)) re_set_long : public re_syntax_base 212 { 213 unsigned int csingles, cranges, cequivalents; 214 mask_type cclasses; 215 mask_type cnclasses; 216 bool isnot; 217 bool singleton; 218 }; </strong></p> <p> All our unit tests pass, and no core occurs. </p> <p> This change also resolves the solaris issue mentioned here: <a class="ext-link" href="http://lists.boost.org/boost-users/2010/03/57717.php"><span class="icon">​</span>http://lists.boost.org/boost-users/2010/03/57717.php</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12624 Trac 1.4.3 John Maddock Thu, 09 Feb 2017 19:08:36 GMT <link>https://svn.boost.org/trac10/ticket/12624#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12624#comment:1</guid> <description> <p> Apologies for getting to this late, can you please tell me, in regex_raw_buffer.hpp what is <code>sizeof(padding)</code> ? And more to the point does adding a <code>boost::uint64_t</code> to the body of <code>struct padding</code> also fix the issue? </p> <p> Ultimately though, I need to fix this <code>boost::alignof</code>. </p> </description> <category>Ticket</category> </item> </channel> </rss>