I’m not sure what’s wrong with the last line but it’s causing the problem, when compiled with gcc/OAT 3.01. It works fine in gcc/OAT 4.20. Creating a temporary variable fixes the problem:
The only thing that helped was to rewrite the code that caused it. This must be some bug in gcc because with the ADS compiler my code that caused the problem worked perfectly!
Compiler errors are rare but they happen.
Maybe you can see if you can upgrade GCC in your 3.01 install using the cygwin installer?
Personally I have only used ARM ADS for all my projects and never had problems with the compiler. (Is there any support in the wavecom sdk’s for the newer ARM compiler offerings? I don’t think we’re too likely to upgrade considering the costs, but it’s still nice to know.)
Here you cast a pointer to a char. Compiler removes 3 senior bytes from the pointer and puts the value in a temporary variable that exists as long as assigment is going on. Then you assign c char to the temporarry variable. As the assigment is over the temporrary variable is destroyed. What’s the point?
The compiler stores the temporarry variable in a register, thats where your compile error shows up.
char *pc=((char *)(&myrec.myU32));
pc[myptr]=c;
Here you store result of casting pointer to char in your variable and right after that assign the variable to another value. What’s the point?