Dear devs,
I faced an issue/bug with nvc++ (from nvhpc 22.11) about ctz.
Here is a minimal example main.cpp
:
#include <stdio.h>
int main() {
int n = 16;
printf("Has builin_ctz : %d\n", __has_builtin(__builtin_ctz));
printf("Use of __builtin_ctz : %d\n", __builtin_ctz(n));
return 0;
}
This example compiled with nvc++ 22.3 (or 22.1) gives me the following (as expected):
root@local:/test# nvc++ --version
nvc++ 22.1-0 64-bit target on x86-64 Linux -tp haswell
NVIDIA Compilers and Tools
Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
root@local:/test# nvc++ -o main ./main.cpp
root@local:/test# ./main
Has builin_ctz : 1
Use of __builtin_ctz : 4
while when compiled with nvc++ 22.11, I got the following wrong results:
root@local:/test# nvc++ --version
nvc++ 22.11-0 64-bit target on x86-64 Linux -tp haswell
NVIDIA Compilers and Tools
Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
root@local:/test# nvc++ -o main ./main.cpp
root@local:/test# ./main
Has builin_ctz : 0
Use of __builtin_ctz : 4
This difference disables me from compiling a more complex program using the ctz feature.
Best.