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

__builtin_nandX

Sebastian_Freundt
400 Views

Is there a reason that __builtin_nand32, __builtin_nand64, __builtin_nand128, __builtin_infd32, __builtin_infd64, __builtin_infd128 aren't exposed in icc, even with gcc compatibility turned on?

While it may seem pedantic, those are needed to initialise globals in C, e.g.:

static _Decimal32 foo = __builtin_infd32();
static _Decimal64 bar = __builtin_nand64("");

In gcc those are considered constant expressions.  GNU libc uses a similar trick to provide NAN and INFINTIY in bits/nan.h and bits/inf.h

I know to work around this one could use

static _Decimal32 foo = (_Decimal32)__builtin_inf();
static _Decimal64 bar = (_Decimal64)__builtin_nan("");

the double equivalent, which is then cast to the target type, but this feels rather hacky.

icc (ICC) 17.0.4 20170411
openSUSE 13.1 (Bottle) (x86_64)
 

0 Kudos
1 Reply
Viet_H_Intel
Moderator
400 Views

Hi Sebastian,

It looks like a GCC compatibility issue. Can you report it at https://supporttickets.intel.com 

Regards,

Viet Hoang

0 Kudos
Reply