This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/33687] New: [missed optimization] unnecessary checks against inifinity with -ffinite-math-only.
- From: "pluto at agmk dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Oct 2007 08:10:38 -0000
- Subject: [Bug tree-optimization/33687] New: [missed optimization] unnecessary checks against inifinity with -ffinite-math-only.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
#include <limits>
template < typename T >
int is_infinity( T value ) throw()
{
if ( !std::numeric_limits< T >::has_infinity )
return 0;
T const inf = std::numeric_limits< T >::infinity();
if ( value == +inf )
return +1;
if ( value == -inf )
return -1;
return 0;
}
template int is_infinity( double );
with -ffinite-math-only the <double> specialization could be optimized
to always return 0 but gcc produces checks against +inf
(aka __builtin_huge_val).
--
Summary: [missed optimization] unnecessary checks against
inifinity with -ffinite-math-only.
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pluto at agmk dot net
GCC target triplet: x86_64-gnu-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33687