Version:7.3.1
Let's consider following example:
static const uint32_t y = 5;
void return_variable(uint32_t* val){ *val = y;}
int main(void) {
uint32_t x = 0; return_variable(&x);
}
I'm assuming that return_variable should modify 'x' variable and set it to 5 but unfortunately it doesn't happen. Inspecting .map file shows that linker discarded 'y' variable even if it's value is obviously used.
Looks like compiler is having difficulties identyfing if variable declared as const is being used or not.
Any thoughts ?
Mateusz Piesta