首先,我使用的是XC16V1.31和MPLAB X V3.65的PIC24FV32 KA302。我有一个奇怪的优化行为,其中只有15个成员的结构只在优化级别设置为1时才使前5个成员消失。这个结构是字符串(char *),后面是一些无符号整数。这是一个刚刚开始出现的新行为,我不确定我能做些什么。我曾试图声明结构不稳定,但似乎没有效果。该变量在结构中的数据甚至未被访问的点上被篡改。我输入一个不相关的函数,中间的结构成员被抹去0。每一次运行时,它的精确点似乎不同,尽管这可能是因为我用优化的代码用ICD3进行调试。除了构建没有优化,还有什么可以尝试的吗?我希望至少有一些大小的优化,因为CODISACACE与应用程序的大小相当小。
以上来自于百度翻译
以下为原文
Hi all,
First things first, I'm using a PIC24FV32KA302 with XC16 v1.31 and MPLAB X v3.65.
I'm having a weird op
timization behavior where a structure with 15 members is getting the first 5 members wiped out only when Optimization Level is set to 1. The structure is as string (char*) followed by a number of unsigned integers.
This is a new behavior that just started to crop up, and I'm not sure what I can really do about it. I've attempted to declare the structure volatile but it seems to have no effect. The variable is getting clobbered at a point where the data in the structure isn't even being accessed. I enter an unrelated function, and midway through it the structure members in question get wiped out to 0. The exact point seems to differ each time I run through it, although this could be since I'm debugging with an ICD3 with optimized code.
Is there anything else I can try other than just building without optimization? I'd prefer to have at least some size optimization, as codespace is rather slim with the size of this application.
Any advice would be appreciated,
Thanks!