Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4872

SDK • Re: Two weird compilation bugs

$
0
0
char buffer[] = "----";
Thanks. That fixed it, both shuffling and reinitialisation.
I'm surprised that -Wall -Werror didn't reject that, with a compilation error message that would have explained the problem.
Me too. Plus the fact that it seems to be able to update 'buffer[3]' in both cases, and prints a non-weird string in both cases. I was expecting something to be 'more odd or bizarre' than that if I was doing something intrinsically wrong.

Part of the issue appears to be because I was building Run in RAM. Built with Run from Flash it does appear that it partially worked in the -O3 case because everything is in RAM. When -O3 and in Flash -

Code:

Enter password[----][----][----][----]
Which is what we would expect if 'buffer' is always pointing to a 'const literal'.

When -O0 and in Flash it simply crashes and hangs 'minicom' after the third key press, needs a power-cycle reset.

I guess 'idiots like me' coming along is why there's such interest in Rust and its proclaimed memory safety.

Statistics: Posted by hippy — Mon May 06, 2024 7:32 pm



Viewing all articles
Browse latest Browse all 4872

Trending Articles