The z specifier in %zu is silently accepted (although unsupported) in the device code and does not work

Can Clang warn on the wrong use at build time?

When a developer writes code like below and build?

#include
int main()
{
size_t my_sz = 123;
#pragma omp target parallel for map(to: my_sz)
for (int i=0;i<1;i++) {
printf(“%zu, %d\n”, my_sz, my_sz);
}
}

Alexey

CUDA dorms implement that, and on POWER8
it just doesn’t work (prints out plain “%zu” literally).

So I was wishing if Clang understands that and

Is changed to not suggest using the zu at all in the device code.

Clang is the latest trunk.

Alexey

Are you using the CUDA 10.2 or higher?

Ok, I see. I stumble upon this “bug” yesterday

and wasted a couple of hours as it was printing bogus values etc.

In Clang printf support is adjusted with the subtle CUDA version?

I’ve also checked going back to CUDA 8 works. So as you suggested it is likely a bug in CUDA 10.0.130
in my programming environment.

To me, printf() support in CUDA is not robust like C implementation. This makes debugging is harder.