Why are format strings showing blank values

I am trying to print some values to stdout calling a “dump” function (part of a library I have made which gets linked at compile time)

void dump(tensor *t, int asfloat) {
  for (int j = 0; j < t->data_len; j++) {
    uint8_t d = ((uint8_t *)t->data)[j];
    printf("%x, ", d);
  }
}

Result:

, , , , , , , , , ,

Is this something to do with privilege level? Can I just run everything at maximum privilege for my tests?

The parentheses look a little strange to me; maybe try something like below? Also, declaring all variables first (at function scope) usually helps the compiler, a lot.

void dump(tensor *t, int asfloat) {
  uint8_t d;
  for (int j = 0; j < t->data_len; j++) {
    d = (uint8_t) ((t->data)[j]);
    printf("%x, ", d);
  }
}

You may also want to check the .lst file output to see exactly what is the code being generated; if not as desired, there might be a compiler option or optimization level that could help.

Nothing here nas anything to do with privilege level though, which is good.

Moving the parentheses changes the semantics in ways that may not be the original intent, depends what data_len is.

No it doesn’t.