nvmlDeviceGetSupportedGraphicsClocks call fails when compiling with Clang/LLVM

Hi, as per title, while I’m trying to compile this nvml code with clang-15, it fails giving me error 7 on the call and totally random values. The code is:

CODE

#include <iostream>
#include <nvml.h>

int main()
{
  nvmlInit();
  nvmlDevice_t dev;

  nvmlDeviceGetHandleByIndex(0, &dev);
  unsigned int count;
  unsigned int clocks[512];

  std::cout << "call: " << nvmlDeviceGetSupportedGraphicsClocks(dev, 1215, &count, clocks) << "\nfrequencies: ";
  for (int i = 0; i < count; i++)
    std::cout << clocks[i] << " ";
  std::cout << "\n";
}

OUTPUT

call: 7
frequencies: 1864164000 32766 0 0 0 0 0 0 0 0 0 0 2 0 230 2147483648 0 0 0 0 0 0 0 0 0 0 0 0 1864163776 32766 1864163776 32766 0 0 0 0 0 0 0 32766 0 0 1593530224 32611 0 0 0 0 0 0 0 0 1629978320 32611 0 0 1593530224 32611 1593530701 32611 1629997576 32611 0 0 1864164320 32766 1024 0 1629975792 32611 1629997576 32611 0 0 1629974528 32611 0 0 0 0 0 

Actually it is also giving me this same issue with gcc.