简体   繁体   English

使用arm-gcc3.3.1在32位pic上进行循环

[英]for loop on 32bit pic with arm-gcc3.3.1

Im going to be downvoted to oblivion but: this question : https://stackoverflow.com/questions/43510049/c99-for-loop-looses-static-variable-values as been tagged as incomplete but its not. 我将被淘汰,但是:这个问题: https ://stackoverflow.com/questions/43510049/c99-for-loop-looses-static-variable-values被标记为不完整,但不是。

User pointed out all elements of a reccurent bug under gcc-arm-toochain3.3.1, and even more reccurent on 32-bit pics (all question from this user are related to those), when working with array of structures inside a structure. 用户指出了在使用结构内部的结构数组时,gcc-arm-toochain3.3.1下的递归错误的所有元素,甚至在32位图片上更为递归(此用户提出的所有问题均与之相关)。

This bug is created by the pic considering the succession on pointer in the structure of structure as a single variable name. 该bug是由pic所创建的,它认为结构的指针上的继承是单个变量名。 when the last bit of the index isnt 0, the buffer overflow reading values with the wrong type as multiple of max int. 当索引的最后一位不为0时,缓冲区溢出读取错误类型为max int倍数的值。

Changing the code from: 更改代码从:

structure1.structure2[i].var1 = blabla;

by 通过

structure2_ * ptr = NULL;
ptr = &structure1.structure2[i];
ptr->var1 = blabla;

will fix it instantly (example recreated under keil3.0 & windows xp with arm-gcc-toolchain 3.3.1 and tested on pic) 会立即修复(例如在带有arm-gcc-toolchain 3.3.1的keil3.0和Windows XP下重新创建并在图片上测试的示例)

Why am I posting this as a question? 我为什么要发布这个问题?

1) Post is on hold thus I cant answer it. 1)职位已暂停,因此我无法回答。

2) I dont have enough reputation thus I can't comment on it. 2)我没有足够的声誉,因此无法对此发表评论。

3) peers whom reviewed the edit didnt considered to push the edit as an answer/comment 3)审核过该编辑的同伴未考虑将其作为答案/评论进行推送

So my question - it should be in meta, but once again not enough reputation - is: Why does edit reviewer don't accept my edit for an on hold question if the edit is the answer to said question? 因此,我的问题-应该在meta中,但声誉又不够高-是:如果编辑是该问题的答案,为什么编辑审稿人不接受我对保留问题的编辑?

Downvote away! 下票了!

edit if someone could link this thread to the other question, I'll appreciate it. 编辑,如果有人可以将此线程链接到另一个问题,我将不胜感激。

我不确定这是否真的是答案,但建议编辑与此帖子相关的内容,而我的问题确实解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM