<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>SafeInt Issue Tracker Rss Feed</title><link>http://www.codeplex.com/SafeInt/WorkItem/List.aspx</link><description>SafeInt Issue Tracker Rss Description</description><item><title>Closed Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791]</title><link>http://safeint.codeplex.com/workitem/8791</link><description>i try to use multiply on int64_t&lt;br /&gt;&amp;#160;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t a&amp;#61;2&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t b&amp;#61;3&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t c&amp;#59;&lt;br /&gt;  SafeMultiply&amp;#60;boost&amp;#58;&amp;#58;int64_t,boost&amp;#58;&amp;#58;int64_t&amp;#62;&amp;#40;a,b,c&amp;#41;&amp;#59;&lt;br /&gt;&amp;#160;&lt;br /&gt;gcc 4.3.2 and 4.4.1 takes compile time error&lt;br /&gt;&amp;#160;&lt;br /&gt;SafeInt3.hpp&amp;#58; In function &amp;#8216;bool SafeMultiply&amp;#40;T, U, T&amp;#38;&amp;#41; &amp;#91;with T &amp;#61; long int, U &amp;#61; long int&amp;#93;&amp;#8217;&amp;#58;&lt;br /&gt;test1.cpp&amp;#58;233&amp;#58;   instantiated from here&lt;br /&gt;SafeInt3.hpp&amp;#58;4995&amp;#58; error&amp;#58; incomplete type &amp;#8216;MultiplicationHelper&amp;#60;long int, long int, 11&amp;#62;&amp;#8217; used in nested name specifier&lt;br /&gt;</description><author>dcleblanc</author><pubDate>Thu, 16 May 2013 08:03:30 GMT</pubDate><guid isPermaLink="false">Closed Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791] 20130516080330A</guid></item><item><title>Created Issue: nullptr and /CLR [15237]</title><link>http://safeint.codeplex.com/workitem/15237</link><description>Using Visual Studio 2008 , it is not possible to include the header in mixed CLR and native code because of the definition of nullptr clashes with CLR usage.&lt;br /&gt;&lt;br /&gt;Given there is only one use of nullptr in SafeInt3.hpp , defining nullptr seems to be a lot of trouble for dubious benefit.&lt;br /&gt;</description><author>KeithBurton</author><pubDate>Thu, 31 May 2012 06:58:46 GMT</pubDate><guid isPermaLink="false">Created Issue: nullptr and /CLR [15237] 20120531065846A</guid></item><item><title>Commented Issue: integer overflows [14278]</title><link>http://safeint.codeplex.com/workitem/14278</link><description>I&amp;#39;ve been tracking down some integer overflows in Firefox and seem to have narrowed some of them down to the SafeInt library.&lt;br /&gt;&lt;br /&gt;As an example, the &amp;#34;a &amp;#61; -a&amp;#59;&amp;#34; assignment at SafeInt3.hpp&amp;#58;2102 is sometimes invoked while a has value INT_MIN.  Of course, negating INT_MIN is undefined behavior in C&amp;#43;&amp;#43;98 and C&amp;#43;&amp;#43;11.  &lt;br /&gt;&lt;br /&gt;To reproduce, change the code like this&amp;#58;&lt;br /&gt;&lt;br /&gt;       if&amp;#40; a &amp;#60; 0 &amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;&amp;#9;  if &amp;#40;a&amp;#61;&amp;#61;INT_MIN&amp;#41; printf &amp;#40;&amp;#34;oops&amp;#33;&amp;#92;n&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;           a &amp;#61; -a&amp;#59;&lt;br /&gt;           fIsNegative &amp;#61; true&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;Then run MultVerify&amp;#40;&amp;#41;.  Here is what I get&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; g&amp;#43;&amp;#43; -O -w TestMain.cpp MultVerify.cpp  -o TestMain&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; .&amp;#47;TestMain&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;&lt;br /&gt;This is 3.0.16p. There are some other overflows in SafeInt, please let me know if you are interested in bug reports about them.&lt;br /&gt;Comments: ** Comment from web user: dcleblanc ** &lt;p&gt;This issue should be addressed by the 3.0.17 release. Note to consumers - 3.0.17 is still considered a beta. It is strongly recommended that if you are using a compiler which aggressively optimizes that you also enable &amp;#40;and pay attention to&amp;#41; the warnings that it is removing code.&lt;/p&gt;</description><author>dcleblanc</author><pubDate>Fri, 23 Sep 2011 07:14:27 GMT</pubDate><guid isPermaLink="false">Commented Issue: integer overflows [14278] 20110923071427A</guid></item><item><title>Commented Issue: integer overflows [14278]</title><link>http://safeint.codeplex.com/workitem/14278</link><description>I&amp;#39;ve been tracking down some integer overflows in Firefox and seem to have narrowed some of them down to the SafeInt library.&lt;br /&gt;&lt;br /&gt;As an example, the &amp;#34;a &amp;#61; -a&amp;#59;&amp;#34; assignment at SafeInt3.hpp&amp;#58;2102 is sometimes invoked while a has value INT_MIN.  Of course, negating INT_MIN is undefined behavior in C&amp;#43;&amp;#43;98 and C&amp;#43;&amp;#43;11.  &lt;br /&gt;&lt;br /&gt;To reproduce, change the code like this&amp;#58;&lt;br /&gt;&lt;br /&gt;       if&amp;#40; a &amp;#60; 0 &amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;&amp;#9;  if &amp;#40;a&amp;#61;&amp;#61;INT_MIN&amp;#41; printf &amp;#40;&amp;#34;oops&amp;#33;&amp;#92;n&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;           a &amp;#61; -a&amp;#59;&lt;br /&gt;           fIsNegative &amp;#61; true&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;Then run MultVerify&amp;#40;&amp;#41;.  Here is what I get&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; g&amp;#43;&amp;#43; -O -w TestMain.cpp MultVerify.cpp  -o TestMain&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; .&amp;#47;TestMain&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;&lt;br /&gt;This is 3.0.16p. There are some other overflows in SafeInt, please let me know if you are interested in bug reports about them.&lt;br /&gt;Comments: ** Comment from web user: dcleblanc ** &lt;p&gt;Thanks for looking into this. I hadn&amp;#39;t previously considered -MIN_INT to be something that a compiler would get overly ambitious about optimizing.&lt;/p&gt;&lt;p&gt;At the moment, I think the scope of the problem is largely when MIN_INT is passed as a compile-time constant to SafeInt. We&amp;#39;re working on an update that will resolve the problem.&lt;/p&gt;</description><author>dcleblanc</author><pubDate>Thu, 22 Sep 2011 23:36:36 GMT</pubDate><guid isPermaLink="false">Commented Issue: integer overflows [14278] 20110922113636P</guid></item><item><title>Commented Issue: integer overflows [14278]</title><link>http://safeint.codeplex.com/workitem/14278</link><description>I&amp;#39;ve been tracking down some integer overflows in Firefox and seem to have narrowed some of them down to the SafeInt library.&lt;br /&gt;&lt;br /&gt;As an example, the &amp;#34;a &amp;#61; -a&amp;#59;&amp;#34; assignment at SafeInt3.hpp&amp;#58;2102 is sometimes invoked while a has value INT_MIN.  Of course, negating INT_MIN is undefined behavior in C&amp;#43;&amp;#43;98 and C&amp;#43;&amp;#43;11.  &lt;br /&gt;&lt;br /&gt;To reproduce, change the code like this&amp;#58;&lt;br /&gt;&lt;br /&gt;       if&amp;#40; a &amp;#60; 0 &amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;&amp;#9;  if &amp;#40;a&amp;#61;&amp;#61;INT_MIN&amp;#41; printf &amp;#40;&amp;#34;oops&amp;#33;&amp;#92;n&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;           a &amp;#61; -a&amp;#59;&lt;br /&gt;           fIsNegative &amp;#61; true&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;Then run MultVerify&amp;#40;&amp;#41;.  Here is what I get&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; g&amp;#43;&amp;#43; -O -w TestMain.cpp MultVerify.cpp  -o TestMain&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; .&amp;#47;TestMain&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;&lt;br /&gt;This is 3.0.16p. There are some other overflows in SafeInt, please let me know if you are interested in bug reports about them.&lt;br /&gt;Comments: ** Comment from web user: regehr ** &lt;p&gt;Below, the full list of integer undefined behaviors seen while running &amp;#42;Verify.cpp.&lt;/p&gt;&lt;p&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2102&amp;#58;16&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2120&amp;#58;25&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2148&amp;#58;16&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2166&amp;#58;25&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2252&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2258&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2269&amp;#58;29&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2305&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2311&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2322&amp;#58;25&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2356&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2367&amp;#58;29&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2400&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2411&amp;#58;25&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2448&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2465&amp;#58;29&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2499&amp;#58;17&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2505&amp;#58;17&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2516&amp;#58;25&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2565&amp;#58;17&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2571&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2582&amp;#58;29&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2629&amp;#58;17&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2635&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2646&amp;#58;25&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2679&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2690&amp;#58;29&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2718&amp;#58;18&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;2729&amp;#58;29&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;3798&amp;#58;44&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;3826&amp;#58;44&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;3855&amp;#58;36&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; &amp;#43;, Reason &amp;#58; Signed Addition Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;3878&amp;#58;36&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; &amp;#43;, Reason &amp;#58; Signed Addition Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;4539&amp;#58;62&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;4570&amp;#58;62&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;4652&amp;#58;27&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;4678&amp;#58;27&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;4782&amp;#58;36&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;4842&amp;#58;36&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;6519&amp;#58;43&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;6521&amp;#58;25&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;868&amp;#58;34&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;UNDEFINED at &amp;#60;.&amp;#47;SafeInt3.hpp, &amp;#40;878&amp;#58;34&amp;#41;&amp;#62; &amp;#58; Op&amp;#58; -, Reason &amp;#58; Signed Subtraction Overflow&lt;br /&gt;&lt;/p&gt;</description><author>regehr</author><pubDate>Thu, 22 Sep 2011 15:03:00 GMT</pubDate><guid isPermaLink="false">Commented Issue: integer overflows [14278] 20110922030300P</guid></item><item><title>Commented Issue: integer overflows [14278]</title><link>http://safeint.codeplex.com/workitem/14278</link><description>I&amp;#39;ve been tracking down some integer overflows in Firefox and seem to have narrowed some of them down to the SafeInt library.&lt;br /&gt;&lt;br /&gt;As an example, the &amp;#34;a &amp;#61; -a&amp;#59;&amp;#34; assignment at SafeInt3.hpp&amp;#58;2102 is sometimes invoked while a has value INT_MIN.  Of course, negating INT_MIN is undefined behavior in C&amp;#43;&amp;#43;98 and C&amp;#43;&amp;#43;11.  &lt;br /&gt;&lt;br /&gt;To reproduce, change the code like this&amp;#58;&lt;br /&gt;&lt;br /&gt;       if&amp;#40; a &amp;#60; 0 &amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;&amp;#9;  if &amp;#40;a&amp;#61;&amp;#61;INT_MIN&amp;#41; printf &amp;#40;&amp;#34;oops&amp;#33;&amp;#92;n&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;           a &amp;#61; -a&amp;#59;&lt;br /&gt;           fIsNegative &amp;#61; true&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;Then run MultVerify&amp;#40;&amp;#41;.  Here is what I get&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; g&amp;#43;&amp;#43; -O -w TestMain.cpp MultVerify.cpp  -o TestMain&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; .&amp;#47;TestMain&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;&lt;br /&gt;This is 3.0.16p. There are some other overflows in SafeInt, please let me know if you are interested in bug reports about them.&lt;br /&gt;Comments: ** Comment from web user: regehr ** &lt;p&gt;I got SafeInt to malfunction due to this undefined behavior by writing this test code&amp;#58;&lt;/p&gt;&lt;p&gt;void test &amp;#40;__int32 a, __int64 b&amp;#41; &amp;#123;&lt;br /&gt;  __int32 ret&amp;#59;&lt;br /&gt;  bool res &amp;#61; SafeMultiply &amp;#40;a, b, ret&amp;#41;&amp;#59;&lt;br /&gt;  if &amp;#40;res&amp;#41; &amp;#123;&lt;br /&gt;    printf &amp;#40;&amp;#34;&amp;#37;d &amp;#42; &amp;#37;lld &amp;#61; &amp;#37;d&amp;#92;n&amp;#34;, a, b, ret&amp;#41;&amp;#59;&lt;br /&gt;  &amp;#125; else &amp;#123;&lt;br /&gt;    printf &amp;#40;&amp;#34;&amp;#37;d &amp;#42; &amp;#37;lld &amp;#61; INVALID&amp;#92;n&amp;#34;, a, b&amp;#41;&amp;#59;&lt;br /&gt;  &amp;#125;&lt;br /&gt;&amp;#125;&lt;/p&gt;&lt;p&gt;int main &amp;#40;void&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;  test &amp;#40;INT_MIN, -2&amp;#41;&amp;#59;&lt;br /&gt;  test &amp;#40;INT_MIN, -1&amp;#41;&amp;#59;&lt;br /&gt;  test &amp;#40;INT_MIN, 0&amp;#41;&amp;#59;&lt;br /&gt;  test &amp;#40;INT_MIN, 1&amp;#41;&amp;#59;&lt;br /&gt;  test &amp;#40;INT_MIN, 2&amp;#41;&amp;#59;&lt;br /&gt;  return 0&amp;#59;&lt;br /&gt;&amp;#125;&lt;/p&gt;&lt;p&gt;Now, watch the answer change as the optimization options are changed&amp;#58;&lt;/p&gt;&lt;p&gt;regehr&amp;#64;home&amp;#58;&amp;#126;&amp;#47;embedded_papers&amp;#47;john&amp;#47;overflow12&amp;#47;safeint&amp;#36; current-g&amp;#43;&amp;#43; -O1 john_test.cpp &amp;#59; .&amp;#47;a.out &lt;br /&gt;-2147483648 &amp;#42; -2 &amp;#61; INVALID&lt;br /&gt;-2147483648 &amp;#42; -1 &amp;#61; INVALID&lt;br /&gt;-2147483648 &amp;#42; 0 &amp;#61; 0&lt;br /&gt;-2147483648 &amp;#42; 1 &amp;#61; -2147483648&lt;br /&gt;-2147483648 &amp;#42; 2 &amp;#61; INVALID&lt;br /&gt;regehr&amp;#64;home&amp;#58;&amp;#126;&amp;#47;embedded_papers&amp;#47;john&amp;#47;overflow12&amp;#47;safeint&amp;#36; current-g&amp;#43;&amp;#43; -O2 john_test.cpp &amp;#59; .&amp;#47;a.out &lt;br /&gt;-2147483648 &amp;#42; -2 &amp;#61; INVALID&lt;br /&gt;-2147483648 &amp;#42; -1 &amp;#61; INVALID&lt;br /&gt;-2147483648 &amp;#42; 0 &amp;#61; 0&lt;br /&gt;-2147483648 &amp;#42; 1 &amp;#61; INVALID&lt;br /&gt;-2147483648 &amp;#42; 2 &amp;#61; INVALID&lt;/p&gt;&lt;p&gt;This is using today&amp;#39;s pre-4.7 G&amp;#43;&amp;#43; snapshot on Ubuntu Linux. Behavior is consistent across x86 and x64.&lt;/p&gt;&lt;p&gt;Basically the current version of SafeInt needs to be compiled with -fwrapv or equivalent in order to function correctly.  Of course, not all compilers support such an option.&lt;/p&gt;</description><author>regehr</author><pubDate>Thu, 22 Sep 2011 03:21:45 GMT</pubDate><guid isPermaLink="false">Commented Issue: integer overflows [14278] 20110922032145A</guid></item><item><title>Created Issue: integer overflows [14278]</title><link>http://safeint.codeplex.com/workitem/14278</link><description>I&amp;#39;ve been tracking down some integer overflows in Firefox and seem to have narrowed some of them down to the SafeInt library.&lt;br /&gt;&lt;br /&gt;As an example, the &amp;#34;a &amp;#61; -a&amp;#59;&amp;#34; assignment at SafeInt3.hpp&amp;#58;2102 is sometimes invoked while a has value INT_MIN.  Of course, negating INT_MIN is undefined behavior in C&amp;#43;&amp;#43;98 and C&amp;#43;&amp;#43;11.  &lt;br /&gt;&lt;br /&gt;To reproduce, change the code like this&amp;#58;&lt;br /&gt;&lt;br /&gt;       if&amp;#40; a &amp;#60; 0 &amp;#41;&lt;br /&gt;        &amp;#123;&lt;br /&gt;&amp;#9;  if &amp;#40;a&amp;#61;&amp;#61;INT_MIN&amp;#41; printf &amp;#40;&amp;#34;oops&amp;#33;&amp;#92;n&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;           a &amp;#61; -a&amp;#59;&lt;br /&gt;           fIsNegative &amp;#61; true&amp;#59;&lt;br /&gt;        &amp;#125;&lt;br /&gt;&lt;br /&gt;Then run MultVerify&amp;#40;&amp;#41;.  Here is what I get&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; g&amp;#43;&amp;#43; -O -w TestMain.cpp MultVerify.cpp  -o TestMain&lt;br /&gt;&amp;#91;regehr&amp;#64;gamow safeint&amp;#93;&amp;#36; .&amp;#47;TestMain&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;oops&amp;#33;&lt;br /&gt;&lt;br /&gt;This is 3.0.16p. There are some other overflows in SafeInt, please let me know if you are interested in bug reports about them.&lt;br /&gt;</description><author>regehr</author><pubDate>Wed, 21 Sep 2011 20:32:12 GMT</pubDate><guid isPermaLink="false">Created Issue: integer overflows [14278] 20110921083212P</guid></item><item><title>Commented Issue: IntrinsicMultiplyUint64 and IntrinsicMultiplyInt64 missing "inline" keyword [13029]</title><link>http://safeint.codeplex.com/workitem/13029</link><description>VS 2010 gives a linker error&amp;#58;&lt;br /&gt;&lt;br /&gt;Error&amp;#9;95&amp;#9;error LNK2005&amp;#58; &amp;#34;bool __cdecl IntrinsicMultiplyUint64&amp;#40;unsigned __int64 const &amp;#38;,unsigned __int64 const &amp;#38;,unsigned __int64 &amp;#42;&amp;#41;&amp;#34; &amp;#40;&amp;#63;IntrinsicMultiplyUint64&amp;#64;&amp;#64;YA_NAEB_K0PEA_K&amp;#64;Z&amp;#41; already defined in...&lt;br /&gt;&lt;br /&gt;Adding &amp;#34;inline&amp;#34; to those function definitions resolves the errors.&lt;br /&gt;Comments: ** Comment from web user: dcleblanc ** &lt;p&gt;I&amp;#39;ll get this fixed in 3.0.15 - thanks for reporting it.&lt;/p&gt;</description><author>dcleblanc</author><pubDate>Tue, 22 Mar 2011 18:24:12 GMT</pubDate><guid isPermaLink="false">Commented Issue: IntrinsicMultiplyUint64 and IntrinsicMultiplyInt64 missing "inline" keyword [13029] 20110322062412P</guid></item><item><title>Created Issue: IntrinsicMultiplyUint64 and IntrinsicMultiplyInt64 missing "inline" keyword [13029]</title><link>http://safeint.codeplex.com/workitem/13029</link><description>VS 2010 gives a linker error&amp;#58;&lt;br /&gt;&lt;br /&gt;Error&amp;#9;95&amp;#9;error LNK2005&amp;#58; &amp;#34;bool __cdecl IntrinsicMultiplyUint64&amp;#40;unsigned __int64 const &amp;#38;,unsigned __int64 const &amp;#38;,unsigned __int64 &amp;#42;&amp;#41;&amp;#34; &amp;#40;&amp;#63;IntrinsicMultiplyUint64&amp;#64;&amp;#64;YA_NAEB_K0PEA_K&amp;#64;Z&amp;#41; already defined in...&lt;br /&gt;&lt;br /&gt;Adding &amp;#34;inline&amp;#34; to those function definitions resolves the errors.&lt;br /&gt;</description><author>kgriffs</author><pubDate>Wed, 16 Feb 2011 20:40:52 GMT</pubDate><guid isPermaLink="false">Created Issue: IntrinsicMultiplyUint64 and IntrinsicMultiplyInt64 missing "inline" keyword [13029] 20110216084052P</guid></item><item><title>Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791]</title><link>http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=8791</link><description>i try to use multiply on int64_t&lt;br /&gt;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t a&amp;#61;2&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t b&amp;#61;3&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t c&amp;#59;&lt;br /&gt;  SafeMultiply&amp;#60;boost&amp;#58;&amp;#58;int64_t,boost&amp;#58;&amp;#58;int64_t&amp;#62;&amp;#40;a,b,c&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;gcc 4.3.2 and 4.4.1 takes compile time error&lt;br /&gt;&lt;br /&gt;SafeInt3.hpp&amp;#58; In function &amp;#8216;bool SafeMultiply&amp;#40;T, U, T&amp;#38;&amp;#41; &amp;#91;with T &amp;#61; long int, U &amp;#61; long int&amp;#93;&amp;#8217;&amp;#58;&lt;br /&gt;test1.cpp&amp;#58;233&amp;#58;   instantiated from here&lt;br /&gt;SafeInt3.hpp&amp;#58;4995&amp;#58; error&amp;#58; incomplete type &amp;#8216;MultiplicationHelper&amp;#60;long int, long int, 11&amp;#62;&amp;#8217; used in nested name specifier&lt;br /&gt;Comments: ** Comment from web user: dcleblanc ** &lt;p&gt;This is now fixed by planned release 3.0.13p&lt;/p&gt;</description><author>dcleblanc</author><pubDate>Thu, 04 Feb 2010 06:10:24 GMT</pubDate><guid isPermaLink="false">Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791] 20100204061024A</guid></item><item><title>Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791]</title><link>http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=8791</link><description>i try to use multiply on int64_t&lt;br /&gt;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t a&amp;#61;2&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t b&amp;#61;3&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t c&amp;#59;&lt;br /&gt;  SafeMultiply&amp;#60;boost&amp;#58;&amp;#58;int64_t,boost&amp;#58;&amp;#58;int64_t&amp;#62;&amp;#40;a,b,c&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;gcc 4.3.2 and 4.4.1 takes compile time error&lt;br /&gt;&lt;br /&gt;SafeInt3.hpp&amp;#58; In function &amp;#8216;bool SafeMultiply&amp;#40;T, U, T&amp;#38;&amp;#41; &amp;#91;with T &amp;#61; long int, U &amp;#61; long int&amp;#93;&amp;#8217;&amp;#58;&lt;br /&gt;test1.cpp&amp;#58;233&amp;#58;   instantiated from here&lt;br /&gt;SafeInt3.hpp&amp;#58;4995&amp;#58; error&amp;#58; incomplete type &amp;#8216;MultiplicationHelper&amp;#60;long int, long int, 11&amp;#62;&amp;#8217; used in nested name specifier&lt;br /&gt;Comments: ** Comment from web user: dcleblanc ** &lt;p&gt;The RegMultiply stuff needs to be kept to internal calls - for example, on the x64 Microsoft compiler, we can get some gains by using intrinsics that just do 128-bit math, just like we check 32-bit math with 64-bit. So I think it is OK to use the __int64 on stuff that we know is purely internal. Once we have the proper template specialization, then I think we&amp;#39;re OK to force things to the __int64 type.&lt;/p&gt;</description><author>dcleblanc</author><pubDate>Wed, 13 Jan 2010 20:19:44 GMT</pubDate><guid isPermaLink="false">Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791] 20100113081944P</guid></item><item><title>Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791]</title><link>http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=8791</link><description>i try to use multiply on int64_t&lt;br /&gt;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t a&amp;#61;2&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t b&amp;#61;3&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t c&amp;#59;&lt;br /&gt;  SafeMultiply&amp;#60;boost&amp;#58;&amp;#58;int64_t,boost&amp;#58;&amp;#58;int64_t&amp;#62;&amp;#40;a,b,c&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;gcc 4.3.2 and 4.4.1 takes compile time error&lt;br /&gt;&lt;br /&gt;SafeInt3.hpp&amp;#58; In function &amp;#8216;bool SafeMultiply&amp;#40;T, U, T&amp;#38;&amp;#41; &amp;#91;with T &amp;#61; long int, U &amp;#61; long int&amp;#93;&amp;#8217;&amp;#58;&lt;br /&gt;test1.cpp&amp;#58;233&amp;#58;   instantiated from here&lt;br /&gt;SafeInt3.hpp&amp;#58;4995&amp;#58; error&amp;#58; incomplete type &amp;#8216;MultiplicationHelper&amp;#60;long int, long int, 11&amp;#62;&amp;#8217; used in nested name specifier&lt;br /&gt;Comments: ** Comment from web user: bmb ** &lt;p&gt;That&amp;#39;s what I did, though I didn&amp;#39;t think to add a compile-time assert &amp;#58;&amp;#41; It took new template arguments to some of the Multiplication, Divison, Addition and Subtraction helpers to make it all work.&lt;/p&gt;&lt;p&gt;Additionally, LargeIntRegMultiply&amp;#60;&amp;#62; was tricky... think about&amp;#58;&lt;br /&gt;template&amp;#60;&amp;#62; class LargeIntRegMultiply&amp;#60; unsigned __int64, unsigned __int64 &amp;#62;&lt;br /&gt;You can&amp;#39;t just change this to template&amp;#60;typename T, typename U&amp;#62;, the same way you can for the various Helpers, since those types are used to select which specialization you want. The way I worked around this was by&lt;br /&gt;changing it to&amp;#58;&lt;br /&gt;template&amp;#60;&amp;#62; class LargeIntRegMultiply&amp;#60; unsigned __int64, unsigned __int64 &amp;#62;&lt;br /&gt;&amp;#123;&lt;br /&gt;    template &amp;#60; typename T, typename U &amp;#62;&lt;br /&gt;    static bool RegMultiply&amp;#40; const T&amp;#38; a, const U&amp;#38; b, T&amp;#38; ret &amp;#41; throw&amp;#40;&amp;#41; ...&lt;br /&gt;&amp;#125;&lt;br /&gt;So the class&amp;#39;s template arguments identify the size of the arguments, but you can still call RegMultiply&amp;#40;&amp;#41; with unsigned long arguments.&lt;/p&gt;&lt;p&gt;Another alternative would be to leave LargeIntRegMultiply as __int64-only, and convert from the true argument types inside MultiplicationHelper. Now that I think about it, this might be cleaner, maybe a little more invasive change though.&lt;/p&gt;</description><author>bmb</author><pubDate>Wed, 13 Jan 2010 14:36:01 GMT</pubDate><guid isPermaLink="false">Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791] 20100113023601P</guid></item><item><title>Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791]</title><link>http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=8791</link><description>i try to use multiply on int64_t&lt;br /&gt;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t a&amp;#61;2&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t b&amp;#61;3&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t c&amp;#59;&lt;br /&gt;  SafeMultiply&amp;#60;boost&amp;#58;&amp;#58;int64_t,boost&amp;#58;&amp;#58;int64_t&amp;#62;&amp;#40;a,b,c&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;gcc 4.3.2 and 4.4.1 takes compile time error&lt;br /&gt;&lt;br /&gt;SafeInt3.hpp&amp;#58; In function &amp;#8216;bool SafeMultiply&amp;#40;T, U, T&amp;#38;&amp;#41; &amp;#91;with T &amp;#61; long int, U &amp;#61; long int&amp;#93;&amp;#8217;&amp;#58;&lt;br /&gt;test1.cpp&amp;#58;233&amp;#58;   instantiated from here&lt;br /&gt;SafeInt3.hpp&amp;#58;4995&amp;#58; error&amp;#58; incomplete type &amp;#8216;MultiplicationHelper&amp;#60;long int, long int, 11&amp;#62;&amp;#8217; used in nested name specifier&lt;br /&gt;Comments: ** Comment from web user: dcleblanc ** &lt;p&gt;Sorry I haven&amp;#39;t responded more quickly. The normal use of SafeMultiply is to let the compiler sort out the types by itself, so it would be&amp;#58;&lt;/p&gt;&lt;p&gt;__int64 a, b, c&amp;#59;&lt;br /&gt;a &amp;#61; x&amp;#59;&lt;br /&gt;b &amp;#61; y&amp;#59;&lt;br /&gt;SafeMultiply&amp;#40;a, b, c&amp;#41;&amp;#59;&lt;/p&gt;&lt;p&gt;Your analysis is correct - all the internal functions take __int64 directly. I can&amp;#39;t see the patch from this &amp;#40;Windows&amp;#41; system, so I&amp;#39;d need to look at the changes. On a Microsoft compiler, the only way to get a 64-bit int is either long long or __int64. I don&amp;#39;t think I&amp;#39;d considered long int. With my compiler, I get this&amp;#58;&lt;/p&gt;&lt;p&gt;&amp;#9;long int a, b, c&amp;#59;&lt;br /&gt;&amp;#9;a &amp;#61; 1&amp;#59;&lt;br /&gt;&amp;#9;b &amp;#61; 2&amp;#59;&lt;br /&gt;&amp;#9;SafeMultiply&amp;#40;a, b, c&amp;#41;&amp;#59;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;#62;&amp;#9;MultiplicationHelper&amp;#60;long,long,1&amp;#62;&amp;#58;&amp;#58;Multiply&amp;#40;const long &amp;#38; t&amp;#61;1, const long &amp;#38; u&amp;#61;2, long &amp;#38; ret&amp;#61;-858993460&amp;#41;  Line 1576&amp;#9;C&amp;#43;&amp;#43;&lt;/p&gt;&lt;p&gt;But then if I make them long long, I get&amp;#58;&lt;/p&gt;&lt;p&gt;&amp;#62;&amp;#9;MultiplicationHelper&amp;#60;__int64,__int64,11&amp;#62;&amp;#58;&amp;#58;Multiply&amp;#40;const __int64 &amp;#38; t&amp;#61;1, const __int64 &amp;#38; u&amp;#61;2, __int64 &amp;#38; ret&amp;#61;-3689348814741910324&amp;#41;  Line 2606&amp;#9;C&amp;#43;&amp;#43;&lt;/p&gt;&lt;p&gt;I have no idea what the standard says about these types, and whose compiler is right, at least with respect to long int vs. long long. I&amp;#39;m fully aware that a long can be any length according to the standard. I have to wonder if we can get away with just not specifying the first 2 template types - looks like the code would work properly either way. For example, we have&amp;#58;&lt;/p&gt;&lt;p&gt;template &amp;#60;&amp;#62; class MultiplicationHelper&amp;#60;__int64, __int64, MultiplicationState_Int64Int64 &amp;#62;&lt;/p&gt;&lt;p&gt;And there is exactly one that refers to MultiplicationState_Int64Int64, and I think we could just change it to&amp;#58;&lt;/p&gt;&lt;p&gt;template &amp;#60;typename T, typename U&amp;#62; class MultiplicationHelper&amp;#60;T, U, MultiplicationState_Int64Int64 &amp;#62;&lt;/p&gt;&lt;p&gt;It should still work, and we could add a compile assert that sizeof&amp;#40;T&amp;#41; &amp;#61;&amp;#61; 8&lt;/p&gt;&lt;p&gt;Is that what you did&amp;#63;&lt;/p&gt;</description><author>dcleblanc</author><pubDate>Wed, 13 Jan 2010 04:21:18 GMT</pubDate><guid isPermaLink="false">Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791] 20100113042118A</guid></item><item><title>Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791]</title><link>http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=8791</link><description>i try to use multiply on int64_t&lt;br /&gt;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t a&amp;#61;2&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t b&amp;#61;3&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t c&amp;#59;&lt;br /&gt;  SafeMultiply&amp;#60;boost&amp;#58;&amp;#58;int64_t,boost&amp;#58;&amp;#58;int64_t&amp;#62;&amp;#40;a,b,c&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;gcc 4.3.2 and 4.4.1 takes compile time error&lt;br /&gt;&lt;br /&gt;SafeInt3.hpp&amp;#58; In function &amp;#8216;bool SafeMultiply&amp;#40;T, U, T&amp;#38;&amp;#41; &amp;#91;with T &amp;#61; long int, U &amp;#61; long int&amp;#93;&amp;#8217;&amp;#58;&lt;br /&gt;test1.cpp&amp;#58;233&amp;#58;   instantiated from here&lt;br /&gt;SafeInt3.hpp&amp;#58;4995&amp;#58; error&amp;#58; incomplete type &amp;#8216;MultiplicationHelper&amp;#60;long int, long int, 11&amp;#62;&amp;#8217; used in nested name specifier&lt;br /&gt;Comments: ** Comment from web user: bmb ** &lt;p&gt;Hi, I see this problem too. I think the issue stems from 64-bit GCC -- on my platform at least,&lt;br /&gt;sizeof&amp;#40;long&amp;#41; &amp;#61;&amp;#61; 8&lt;br /&gt;sizeof&amp;#40;long long&amp;#41; &amp;#61;&amp;#61; 8&lt;br /&gt;To the type checker, those types aren&amp;#39;t equivalent, even though they have the same size. But, the existing GCC code essentially assumes that long long &amp;#40;a.k.a __int64&amp;#41; is the only 64 bit type, so any Helper specialization that&amp;#39;s 64-bit only takes __int64 directly instead of taking a type argument.&lt;/p&gt;&lt;p&gt;I took a stab at fixing this and have a &amp;#40;prototype&amp;#41; patch, it adds template arguments to several Helper definitions so that they can be generated for long and for long long. Also included in this patch are workarounds to eliminate GCC warnings &amp;#40;-Wall is clean for me on gcc 4.2.4&amp;#41;. I&amp;#39;ve only compile-tested so far, and only on GCC.&lt;/p&gt;&lt;p&gt;Does something like this seem workable&amp;#63; If so, I&amp;#39;d be happy to clean it up and submit it. &amp;#40;and separate it into 2 parts if need be&amp;#41;&lt;/p&gt;&lt;p&gt;Thanks,&lt;br /&gt;Brian Bloniarz&lt;/p&gt;</description><author>bmb</author><pubDate>Wed, 13 Jan 2010 00:43:15 GMT</pubDate><guid isPermaLink="false">Commented Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791] 20100113124315A</guid></item><item><title>Created Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791]</title><link>http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=8791</link><description>i try to use multiply on int64_t&lt;br /&gt;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t a&amp;#61;2&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t b&amp;#61;3&amp;#59;&lt;br /&gt;  boost&amp;#58;&amp;#58;int64_t c&amp;#59;&lt;br /&gt;  SafeMultiply&amp;#60;boost&amp;#58;&amp;#58;int64_t,boost&amp;#58;&amp;#58;int64_t&amp;#62;&amp;#40;a,b,c&amp;#41;&amp;#59;&lt;br /&gt;&lt;br /&gt;gcc 4.3.2 and 4.4.1 takes compile time error&lt;br /&gt;&lt;br /&gt;SafeInt3.hpp&amp;#58; In function &amp;#8216;bool SafeMultiply&amp;#40;T, U, T&amp;#38;&amp;#41; &amp;#91;with T &amp;#61; long int, U &amp;#61; long int&amp;#93;&amp;#8217;&amp;#58;&lt;br /&gt;test1.cpp&amp;#58;233&amp;#58;   instantiated from here&lt;br /&gt;SafeInt3.hpp&amp;#58;4995&amp;#58; error&amp;#58; incomplete type &amp;#8216;MultiplicationHelper&amp;#60;long int, long int, 11&amp;#62;&amp;#8217; used in nested name specifier&lt;br /&gt;</description><author>stuav</author><pubDate>Wed, 16 Sep 2009 11:11:58 GMT</pubDate><guid isPermaLink="false">Created Issue: bug gcc 4.3.2 and 4.4.1 int64_t [8791] 20090916111158A</guid></item><item><title>Created Issue: Potential performance gain from non-member operator+</title><link>http://safeint.codeplex.com/WorkItem/View.aspx?WorkItemId=7910</link><description>Hi David,&lt;br /&gt;&lt;br /&gt;I very much enjoyed your show at http&amp;#58;&amp;#47;&amp;#47;channel9.msdn.com, together with Ale Contenti, and I&amp;#39;m glad to hear that SafeInt is doing so well at Microsoft.&lt;br /&gt;&lt;br /&gt;You have clearly put a lot of effort into the performance of SafeInt, but there may still be another opportunity.  I got the impression from your presentation that users often deal with SafeInt objects that are created on the fly, as unnamed temporary objects &amp;#40;&amp;#34;rvalues&amp;#34;&amp;#41;. For example, when i and j are built-in integers, a user might do&amp;#58;&lt;br /&gt;&lt;br /&gt;  result &amp;#61; SafeInt&amp;#60;int&amp;#62;&amp;#40;i&amp;#41; &amp;#43; j&amp;#59;&lt;br /&gt;&lt;br /&gt;This will call your operator&amp;#43; template member function&amp;#58;&lt;br /&gt;&lt;br /&gt;    template &amp;#60; typename U &amp;#62;&lt;br /&gt;    SafeInt&amp;#60; T, E &amp;#62; operator &amp;#43;&amp;#40; U rhs &amp;#41; const&lt;br /&gt;&lt;br /&gt;Now when the optimizer applies &amp;#34;copy elision&amp;#34;, you might save a few machine instructions, by having operator&amp;#43; as a non-member friend function instead&amp;#58;&lt;br /&gt; &lt;br /&gt;    template &amp;#60; typename U &amp;#62;&lt;br /&gt;    friend SafeInt&amp;#60; T, E &amp;#62; operator &amp;#43;&amp;#40;SafeInt&amp;#60; T, E &amp;#62; lhs, U rhs &amp;#41;&lt;br /&gt;    &amp;#123;&lt;br /&gt;        details&amp;#58;&amp;#58;AdditionHelper&amp;#60; T, T, E &amp;#62;&amp;#58;&amp;#58;Addition&amp;#40; lhs.m_int, rhs, lhs.m_int &amp;#41;&amp;#59;&lt;br /&gt;        return lhs&amp;#59;   &lt;br /&gt;    &amp;#125;&lt;br /&gt;&lt;br /&gt;The C&amp;#43;&amp;#43; Standard allows the compiler to skip a copy-construction, when the unnamed temporary, SafeInt&amp;#60;int&amp;#62;&amp;#40;i&amp;#41;, is passed &amp;#34;by value&amp;#34; to a function.  And indeed, looking at the ASM code of a little SafeInt&amp;#60;int&amp;#62; test &amp;#40;generated by VC&amp;#43;&amp;#43; 2010 beta 1, release configuration&amp;#41;, the &amp;#34;friend version&amp;#34; skips a few instructions, that the original version does&amp;#58;&lt;br /&gt;&lt;br /&gt;&amp;#9;lea&amp;#9;eax, DWORD PTR &amp;#36;T5821&amp;#91;ebp&amp;#93;&lt;br /&gt;&amp;#9;mov&amp;#9;DWORD PTR &amp;#36;T5821&amp;#91;ebp&amp;#93;, edx&lt;br /&gt;&lt;br /&gt;Honestly I haven&amp;#39;t yet tested extensively, but it looks like there&amp;#39;s some gain here...&lt;br /&gt;&lt;br /&gt;HTH, Niels&lt;br /&gt;</description><author>Niels_Dekker</author><pubDate>Fri, 19 Jun 2009 23:03:19 GMT</pubDate><guid isPermaLink="false">Created Issue: Potential performance gain from non-member operator+ 20090619110319P</guid></item><item><title>Created Issue: Need to use standard defines for GCC, remove warnings from test rig</title><link>http://www.codeplex.com/SafeInt/WorkItem/View.aspx?WorkItemId=6711</link><description>Switch to &amp;#35;ifdef __GNUC__, suppress warnings from test rig, try seeing if we can raise warning level to -Wall.&lt;br /&gt;</description><author>dcleblanc</author><pubDate>Wed, 03 Dec 2008 18:51:57 GMT</pubDate><guid isPermaLink="false">Created Issue: Need to use standard defines for GCC, remove warnings from test rig 20081203065157P</guid></item><item><title>Created Issue: SafeInt does not compile correctly on MacOS</title><link>http://www.codeplex.com/SafeInt/WorkItem/View.aspx?WorkItemId=6710</link><description>We&amp;#39;re getting compiler errors out of anything where the return type is known and we accept SafeInt&amp;#60;T&amp;#62; op SafeInt&amp;#60;U&amp;#62;.&lt;br /&gt;</description><author>dcleblanc</author><pubDate>Wed, 03 Dec 2008 18:49:35 GMT</pubDate><guid isPermaLink="false">Created Issue: SafeInt does not compile correctly on MacOS 20081203064935P</guid></item><item><title>Commented Issue: Five changes to improve C++ Standard conformance</title><link>http://www.codeplex.com/SafeInt/WorkItem/View.aspx?WorkItemId=6534</link><description>Hi David&amp;#33;&lt;br /&gt;&lt;br /&gt;I&amp;#39;m glad to see that SafeInt is back again&amp;#33;  Actually I made a few changes to my local copy, in order to improve its conformance to the C&amp;#43;&amp;#43; Standard. Please consider merging them into the official version. I made the following changes&amp;#58;&lt;br /&gt;&lt;br /&gt; &amp;#42; Removed template magic from IsFloat, because it&amp;#39;s non-Standard &amp;#40;sorry&amp;#41;.&lt;br /&gt;Your version depends on __is_enum, which is a Microsoft compiler extension, and it uses &amp;#40; &amp;#40;T&amp;#41;&amp;#40; &amp;#40;float&amp;#41;1.1 &amp;#41; &amp;#62; &amp;#40;T&amp;#41;1 &amp;#41; as if it&amp;#39;s an &amp;#34;integral constant expression&amp;#34; &amp;#40;ICE&amp;#41;, which is also non-standard at the moment...&lt;br /&gt;&lt;br /&gt; &amp;#42; Replaced C_ASSERT&amp;#40;false&amp;#41; by C_ASSERT&amp;#40;sizeof&amp;#40;T&amp;#41; &amp;#61;&amp;#61; 0&amp;#41;, because C_ASSERT&amp;#40;false&amp;#41; might yield compile errors before template instantiation.&lt;br /&gt;See also&amp;#58; Boost.StaticAssert, &amp;#34;Use in templates&amp;#34;, by Steve Cleary and John Maddock&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;www.boost.org&amp;#47;doc&amp;#47;html&amp;#47;boost_staticassert.html&amp;#35;boost_staticassert.templates&lt;br /&gt;&lt;br /&gt; &amp;#42; Removed &amp;#40;unsigned __int64&amp;#41; cast from tmp argument, to avoid passing an unnamed temporary object &amp;#40;rvalue&amp;#41; by reference to RegMultiply.&lt;br /&gt;David, please double-check&amp;#58; &amp;#40;unsigned __int64&amp;#41;tmp might have been a bug&amp;#33; And if it isn&amp;#39;t a bug, I might have introduced one&amp;#33; &lt;br /&gt;&lt;br /&gt; &amp;#42; Added template keywords &amp;#40;&amp;#34;&amp;#58;&amp;#58;template&amp;#34;&amp;#41; to dependent member-names.&lt;br /&gt;See also Comeau C&amp;#43;&amp;#43; Template FAQ, &amp;#34;What is the -&amp;#62;template, .template and &amp;#58;&amp;#58;template syntax about&amp;#63;&amp;#34;&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;www.comeaucomputing.com&amp;#47;techtalk&amp;#47;templates&amp;#47;&amp;#35;templateprefix&lt;br /&gt;&lt;br /&gt; &amp;#42; Replaced _int64 by __int64, in Addition. &amp;#40;Mind the underscores&amp;#33;&amp;#41;&lt;br /&gt;Just a typo, I assume&amp;#33;&lt;br /&gt;&lt;br /&gt;The issues were found with help from g&amp;#43;&amp;#43;-4 &amp;#40;GCC&amp;#41; 4.3.2, running on cygwin. But note&amp;#58; these issues are not GCC-specific&amp;#33; Hereby attached my modified version of 3.0.11p&lt;br /&gt;Comments: ** Comment from web user: dcleblanc ** &lt;p&gt;Thanks - that will allow us to raise the warning level. I also got Michael Howard to try compiling on a Mac, and it has all sorts of interesting errors - seems they&amp;#39;re behind on the gcc version. Also nice to know what the right &amp;#35;ifdef to use for gcc - I&amp;#39;ll correct that.&lt;/p&gt;</description><author>dcleblanc</author><pubDate>Wed, 03 Dec 2008 18:42:59 GMT</pubDate><guid isPermaLink="false">Commented Issue: Five changes to improve C++ Standard conformance 20081203064259P</guid></item><item><title>Commented Issue: Five changes to improve C++ Standard conformance</title><link>http://www.codeplex.com/SafeInt/WorkItem/View.aspx?WorkItemId=6534</link><description>Hi David&amp;#33;&lt;br /&gt;&lt;br /&gt;I&amp;#39;m glad to see that SafeInt is back again&amp;#33;  Actually I made a few changes to my local copy, in order to improve its conformance to the C&amp;#43;&amp;#43; Standard. Please consider merging them into the official version. I made the following changes&amp;#58;&lt;br /&gt;&lt;br /&gt; &amp;#42; Removed template magic from IsFloat, because it&amp;#39;s non-Standard &amp;#40;sorry&amp;#41;.&lt;br /&gt;Your version depends on __is_enum, which is a Microsoft compiler extension, and it uses &amp;#40; &amp;#40;T&amp;#41;&amp;#40; &amp;#40;float&amp;#41;1.1 &amp;#41; &amp;#62; &amp;#40;T&amp;#41;1 &amp;#41; as if it&amp;#39;s an &amp;#34;integral constant expression&amp;#34; &amp;#40;ICE&amp;#41;, which is also non-standard at the moment...&lt;br /&gt;&lt;br /&gt; &amp;#42; Replaced C_ASSERT&amp;#40;false&amp;#41; by C_ASSERT&amp;#40;sizeof&amp;#40;T&amp;#41; &amp;#61;&amp;#61; 0&amp;#41;, because C_ASSERT&amp;#40;false&amp;#41; might yield compile errors before template instantiation.&lt;br /&gt;See also&amp;#58; Boost.StaticAssert, &amp;#34;Use in templates&amp;#34;, by Steve Cleary and John Maddock&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;www.boost.org&amp;#47;doc&amp;#47;html&amp;#47;boost_staticassert.html&amp;#35;boost_staticassert.templates&lt;br /&gt;&lt;br /&gt; &amp;#42; Removed &amp;#40;unsigned __int64&amp;#41; cast from tmp argument, to avoid passing an unnamed temporary object &amp;#40;rvalue&amp;#41; by reference to RegMultiply.&lt;br /&gt;David, please double-check&amp;#58; &amp;#40;unsigned __int64&amp;#41;tmp might have been a bug&amp;#33; And if it isn&amp;#39;t a bug, I might have introduced one&amp;#33; &lt;br /&gt;&lt;br /&gt; &amp;#42; Added template keywords &amp;#40;&amp;#34;&amp;#58;&amp;#58;template&amp;#34;&amp;#41; to dependent member-names.&lt;br /&gt;See also Comeau C&amp;#43;&amp;#43; Template FAQ, &amp;#34;What is the -&amp;#62;template, .template and &amp;#58;&amp;#58;template syntax about&amp;#63;&amp;#34;&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;www.comeaucomputing.com&amp;#47;techtalk&amp;#47;templates&amp;#47;&amp;#35;templateprefix&lt;br /&gt;&lt;br /&gt; &amp;#42; Replaced _int64 by __int64, in Addition. &amp;#40;Mind the underscores&amp;#33;&amp;#41;&lt;br /&gt;Just a typo, I assume&amp;#33;&lt;br /&gt;&lt;br /&gt;The issues were found with help from g&amp;#43;&amp;#43;-4 &amp;#40;GCC&amp;#41; 4.3.2, running on cygwin. But note&amp;#58; these issues are not GCC-specific&amp;#33; Hereby attached my modified version of 3.0.11p&lt;br /&gt;Comments: ** Comment from web user: Niels_Dekker ** &lt;p&gt;GCC version 4.2 or higher allows warnings to be disabled by a pragma.  For example, the following would disable &amp;#34;warning&amp;#58; unused variable &amp;#39;fooBar&amp;#39;&amp;#34;&amp;#58;&lt;/p&gt;&lt;p&gt;&amp;#35;ifdef __GNUC__&lt;br /&gt;&amp;#35;if __GNUC__ &amp;#62; 4 &amp;#124;&amp;#124; &amp;#40;__GNUC__ &amp;#61;&amp;#61; 4 &amp;#38;&amp;#38; __GNUC_MINOR__ &amp;#62; 1&amp;#41;&lt;br /&gt;&amp;#47;&amp;#47; GCC version 4.2 or higher&amp;#58;&lt;br /&gt;&amp;#35;pragma GCC diagnostic ignored &amp;#34;-Wunused-variable&amp;#34;&lt;br /&gt;&amp;#35;endif&lt;br /&gt;&amp;#35;endif&lt;br /&gt;See&amp;#58; &lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;gcc.gnu.org&amp;#47;onlinedocs&amp;#47;gcc&amp;#47;Diagnostic-Pragmas.html&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;gcc.gnu.org&amp;#47;onlinedocs&amp;#47;gcc&amp;#47;Warning-Options.html&lt;/p&gt;&lt;p&gt;Unfortunately it doesn&amp;#39;t seem to offer push&amp;#47;pop for warnings. It doesn&amp;#39;t seem to disable the enum warning either &amp;#40;&amp;#34;-Wenum-compare&amp;#34;&amp;#41;.  But luckily you&amp;#39;ve worked around that one already.&lt;/p&gt;</description><author>Niels_Dekker</author><pubDate>Wed, 03 Dec 2008 16:44:23 GMT</pubDate><guid isPermaLink="false">Commented Issue: Five changes to improve C++ Standard conformance 20081203044423P</guid></item></channel></rss>