PROGMEM variables and arrays are correctly read without pgm_read functions, why?

Hi. Trying to save some memory space, I declared a bunch of constant variables and arrays as PROGMEM. To my surprise, my sketch compiled and run correctly without further changes, i.e. without using any pgm_read_* function at all.

I tried using pgm_read_* anyway, and it worked just fine, obviously.

Why is that? The official guide doesn't mention anything. Does the compiler make some automatic "translation" when PROGMEM variables are used?

I'm very curious about it because if that's confirmed, I prefer to leave the code as it is, for two reason: code clarity and the possibility to "go back" to using SRAM anytime I want, just by changing declarations only.


EDIT / UPDATE: double array access doesn't work as it is. For example v = arr[j][k] doesn't return the correct value; but it does if I split it, like tmp = arr[j]; v = tmp[k]. This makes me think that, in fact, there's an automatic code "conversion" at compile-time, which detect only "basic" accesses only.

Where's me Ouija board, eh?

I can barely make out a line now and then with my Hyperspace Octopupler, why not make it easy on us and post your code. :slight_smile: