Nvc++ doesn't recognize `unsigned __int128`?

The HPC Compiler Reference manual, section 1.2, suggests that C/C++ supports the unsigned __int128 type. I’ve tried compiling the following test program with nvhpc/21.11+gcc/9.40 and nvhpc/21.9+gcc/8.3.0, and get compilation errors on both versions, although the respective g++ compiles work fine:

int main() {
  using uint128_t = unsigned __int128; 
  uint128_t foo = static_cast<uint128_t>(2UL);
  return 0;

The compilation error is:

"/home/phenning/uint128.cc", line 2: error: expected a ";"
    using uint128_t = unsigned __int128;

which suggests to me that the compiler doesn’t recognize __int128. This is for Linux_x86_64, running on a Cascade Lake node. Am I missing something?


Hi pjh40,

__int128 is supported but not enabled by default. Please add the “-Mint128” flag on the compilation line to enable.

See: HPC Compiler Reference Manual Version 21.11 for ARM, OpenPower, x86

Hope this helps,

% nvc++ -c test.cpp -std=c++17 -w
"test.cpp", line 2: error: expected a ";"
    using uint128_t = unsigned __int128;

1 error detected in the compilation of "test.cpp".
% nvc++ -c test.cpp -std=c++17 -w -Mint128

Great, thanks Mat!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.