Community
cancel
Showing results for 
Search instead for 
Did you mean: 
nemequ
New Contributor I
67 Views

__builtin_expect_with_probability unsupported but __has_builtin claims otherwise

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
1 Reply
SantoshY_Intel
Moderator
46 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


Reply