Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

__builtin_expect() chokes on dfp754

$
0
0

As defined in IEEE-754 comparisons with NAN should always yield false, this works:

 

#define __STDC_WANT_DEC_FP__
#include <dfp754.h>

if (0.4dd > nand64("")) {
        return 1;
}
return 0;

 

Now, __builtin_expect is to give advice to the compiler about the outcome of a boolean expression, it shouldn't change the code path at all, however it does:

#define __STDC_WANT_DEC_FP__
#include <dfp754.h>

if (__builtin_expect(0.4dd > nand64(""), 0)) {
        return 1;
}
return 0;

 

This snippet compiled with icc (ICC) 17.0.4 20170411 will now return 1.

 


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>