This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/33687] New: [missed optimization] unnecessary checks against inifinity with -ffinite-math-only.


#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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]