[Bug other/50610] G++ 4.4.3: Incorrect code at -O2 (-fwrapv, SafeInt, c++ templates, template class files)

noloader at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 4 05:24:00 GMT 2011


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

--- Comment #2 from Jeffrey Walton <noloader at gmail dot com> 2011-10-04 05:24:20 UTC ---
For this problem, the work around was:

   try
   {
     const T* base = ptr;
     base += SafeInt<size_t>(cnt);
   }
   catch(const SafeIntException&)
   {
     throw InvalidArgumentException("Array pointer wrap");
   }

It seems LeBlanc had it all the time, but I was not using it. My apologies.



More information about the Gcc-bugs mailing list