Boost C++ Libraries: Ticket #6886: Bugs in boost/regex/icu.hpp (patch included) https://svn.boost.org/trac10/ticket/6886 <p> I am 100% sure I already reported these a couple of years ago (when 1.45 was current), but I just realized they haven't been fixed yet. </p> <p> In boost/regex/icu.hpp: </p> <p> Line 238 has a preprocessor #if that does special handling if BOOST_NO_MEMBER_TEMPLATES or <span class="underline">IBMCPP</span> is defined. That's why the buggy code doesn't show itself on "average" machines. However, when trying to compile Boost.regex with ICU support on an AIX machine, compilation fails due to two bugs in the #else part of the code. </p> <p> The first bug is in line 314: </p> <blockquote> <p> typedef std::vector&lt;UCHAR32&gt; vector_type; </p> </blockquote> <p> The type is UChar32, not UCHAR32. The two templates before this one got it right, this template got it wrong. </p> <p> The second bug is in line 318: </p> <blockquote> <p> v.push_back((UCHAR32)(*i)); </p> </blockquote> <p> Same as above - should be UChar32. </p> <p> The third bug is a classic copy&amp;paste error. In line 319: </p> <blockquote> <p> ++a; </p> </blockquote> <p> If you look at the surrounding code, there is no "a" defined here. The two previous templates define a 32-bit integer "a" by type-converting the "i" parameter (which is 8-bit in the first template and 16-bit in the second one), but in this third template "i" is 32-bit itself already, so there is no need to convert it. You see the surrounding "while" loop and the push_back() call using "i" directly, and the increment should do the same. </p> <p> The patch: </p> <p> 314c314 &lt; typedef std::vector&lt;UCHAR32&gt; vector_type; --- </p> <blockquote> <p> typedef std::vector&lt;UChar32&gt; vector_type; </p> </blockquote> <p> 318,319c318,319 &lt; v.push_back((UCHAR32)(*i)); &lt; ++a; --- </p> <blockquote> <p> v.push_back((UChar32)(*i)); ++i; </p> </blockquote> <p> CVS Web link for ease of reference: </p> <p> <a class="ext-link" href="http://boost.cvs.sourceforge.net/viewvc/boost/boost/boost/regex/icu.hpp?view=markup"><span class="icon">​</span>http://boost.cvs.sourceforge.net/viewvc/boost/boost/boost/regex/icu.hpp?view=markup</a> </p> <p> It would be nice if someone could commit this patch, because this bug has been around since v1.33... </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6886 Trac 1.4.3 Martin Baute <solar@…> Thu, 10 May 2012 11:36:21 GMT <link>https://svn.boost.org/trac10/ticket/6886#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6886#comment:1</guid> <description> <p> Whoops, formatting... the patch: </p> <pre class="wiki">314c314 &lt; typedef std::vector&lt;UCHAR32&gt; vector_type; --- &gt; typedef std::vector&lt;UChar32&gt; vector_type; 318,319c318,319 &lt; v.push_back((UCHAR32)(*i)); &lt; ++a; --- &gt; v.push_back((UChar32)(*i)); &gt; ++i; </pre><p> We (my employer) have been using this patch for the last three or four years, so you could say it's tested. ;-) </p> </description> <category>Ticket</category> </item> <item> <author>Martin Baute <solar@…></author> <pubDate>Fri, 11 May 2012 07:44:11 GMT</pubDate> <title>summary changed https://svn.boost.org/trac10/ticket/6886#comment:2 https://svn.boost.org/trac10/ticket/6886#comment:2 <ul> <li><strong>summary</strong> <span class="trac-field-old">Bugs in boost/regex/icu.hpp</span> → <span class="trac-field-new">Bugs in boost/regex/icu.hpp (patch included)</span> </li> </ul> Ticket John Maddock Fri, 11 May 2012 18:15:39 GMT <link>https://svn.boost.org/trac10/ticket/6886#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6886#comment:3</guid> <description> <p> I believe all these issues have been fixed, note that the source code you referenced was in the old CVS repro which hasn't been used in many years. Current source is here: <a class="ext-link" href="http://svn.boost.org/svn/boost/trunk/boost/regex/icu.hpp"><span class="icon">​</span>http://svn.boost.org/svn/boost/trunk/boost/regex/icu.hpp</a> and doesn't contain UCHAR32 anywhere. </p> <p> Please reopen if I've missed anything. </p> <p> BTW, can the IBM specific workarounds be removed from recent compiler releases? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 11 May 2012 20:17:55 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6886#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6886#comment:4</guid> <description> <p> Ah, I see... perhaps it would be a good idea to link the source somewhere (more) prominent from boost.org, and shutting down the SF.net repo in the admin interface. (It was possible to do so when I last used <a class="missing wiki">SourceForge</a>, which admittedly is a couple of years since.) I clicked around the site for some time looking for "my" patch, and eventually ended up in the SF.net repository thinking that the issue hadn't been fixed. </p> <p> I'll give the new IBM compiler a try sometime next week. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 15 May 2012 16:08:59 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6886#comment:5 https://svn.boost.org/trac10/ticket/6886#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> Ticket