At least it seems it is not a bug.
For dynamic or static arrays, the function returns the number of elements in the array.
No exceptions.Well, I think here an exception is warranted if it draws in too much code.
I don't have a working compiler handy currently, but I imagine that the problem could be lack of support for dynamic arrays, pointers being initialized to flash storage, or the program not crashing because you don't have a working heapmgr when the arrays are allocated (if they are allocated). Either way, a bug for sure
And this also doesn't work:
test : array of byte = (1, 2, 3, 4, 10); section '.progmem';
For this only $4e02 was written in flash memory.
Probably same reasons as PascalDragon explained.
I've fixed the issue with the Length and High in c59b6a5d (https://gitlab.com/freepascal.org/fpc/source/-/commit/c59b6a5d8dfa4a20eec23345839d116905de03f5).
Not the same reason. It's instead that only the pointer to the array is stored in the flash memory, but not the array data itself. Please report it as a bug.
Quote from: PascalDragonNot the same reason. It's instead that only the pointer to the array is stored in the flash memory, but not the array data itself. Please report it as a bug.
Reported: https://gitlab.com/freepascal.org/fpc/source/-/issues/39534 (https://gitlab.com/freepascal.org/fpc/source/-/issues/39534)
Please note however that even if it's fixed it will probably need ccrause's merge request so that the compiler can transparently access data stored in e.g. EEPROM so that it can be used nicely.