Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7957 Discussions

__builtin_expect_with_probability unsupported but __has_builtin claims otherwise

nemequ
New Contributor I
692 Views

When attempting to use __builtin_expect_with_probability (after checking for support using __has_builtin(__builtin_expect_with_probability), icc seems to think it is a regular function, which causes a failure at link time.  Here is a quick test case:

 

#if defined(__has_builtin)
#  define MY_HAS_BUILTIN(builtin) __has_builtin(builtin)
#else
#  define MY_HAS_BUILTIN(builtin) (0)
#endif

bool foo(bool bar) {
    #if MY_HAS_BUILTIN(__builtin_expect_with_probability)
        return __builtin_expect_with_probability(bar, true, 0.99);
    #else
        return __builtin_expect(bar, true);
    #endif
}

 

Or, on godbolt if you prefer: https://godbolt.org/z/4rxqqaGqr

0 Kudos
2 Replies
SantoshY_Intel
Moderator
671 Views

Hi,


Thanks for reaching out to us.

We are able to reproduce the error and we are working on it. We will get back to you soon.


Thanks & Regards,

Santosh


0 Kudos
Viet_H_Intel
Moderator
459 Views

Hi,


Not sure if you are aware of, but Intel Classic Compiler will enter "Legacy Product Support" mode, signaling the end of regular updates. For that reason, we won't fix this issue in icpc. Please migrate your code to icx/icpx.

I am going to close this thread as "wont fix".

https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.h...


Sorry for the inconvenience.


0 Kudos
Reply