Using ARM CC compiler V5.06 update 3 (build 300). I see some quirkiness with macro calculations when using a preprocessor macro that refers to other macros. It seems the value is byte trimmed. Tried several optimization flags but the behavior is the same.
bleyer.org/.../armcc_macrobug.gif
If I extract the function from the project and compile it standalone then the issue is gone, so I suspect the preprocessor or the compiler gets confused from whatever happens on a bigger project.
Pier, many thanks for your reply.
As you suggested, I had tried everything but the problem persisted. I ended up inspecting the project file and the XML was corrupted! There was a dangling pck_BUFFERSIZE definition along with some garbage text under the <Cads> and <Define> sections that didn't show up in the IDE, but I found was being passed to the compiler in the command line. I recreated the project file from scratch and now everything works as expected.
This is not the first time I have problems with the files that uVision handles. There is also another bug in the latest releases that, every once in a while, it complains that it cannot save a source code file, and if you close the IDE, the file is gone. It seems to originate from the way it handles temporary backup files in Windows. Perhaps the corrupt project file is another aspect of the same problem.
Best.