This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/50610] G++ 4.4.3: Incorrect code at -O2 (-fwrapv, SafeInt, c++ templates, template class files)
- From: "noloader at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 04 Oct 2011 05:24:20 +0000
- Subject: [Bug other/50610] G++ 4.4.3: Incorrect code at -O2 (-fwrapv, SafeInt, c++ templates, template class files)
- Auto-submitted: auto-generated
- References: <bug-50610-4@http.gcc.gnu.org/bugzilla/>
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.