Use of isnan function in C - OpenACC

I’m trying to use function isnan from math.h but it is not recognized by pgcc. If I run this minimal example.c:

#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <stdio.h>
#include <omp.h>

int main (int argc, char *argv[]) {

    int sizeV = 10;
    int range = 10;
    double *restrict numbers = malloc(sizeof(double)*sizeV);
    double *restrict results = malloc(sizeof(double)*sizeV);

    for (int i=0;i < sizeV;i++) {
        numbers[i] = (double) rand() * range / (double) RAND_MAX;
    #pragma acc kernels
        for (int i=0;i< sizeV;i++) {
	        results[i] = isnan(numbers[i]);

    for (int i=0;i < sizeV;i++) {
        printf("Results  %f\n", results[i]);


And compile it using:

pgcc -lm   -fast -ta=tesla:managed -Minfo=accel example.c -o Test

I get the following error:

26, Accelerator restriction: call to '__isnan' with no acc routine information

So I guess it is a bug, isn’t it? How can I solve it?

You may find some help with
which discusses using a CUDA ISNAN function called from OpenACC.


But that’s Fortran not C so the syntax and usage is different…

Hi jcastro9999,

We have an open feature request (TPR#21342) for isnan, as well as isfinite, isinf, isnormal, etc., but haven’t added this support to the compiler. I’ll add your request to this TPR and see about increasing the priority.