<div dir='rtl'><div dir="ltr">Hi David,<br /><br /></div>
<div dir="ltr"> </div>
<div dir="ltr">Thanks for your reply. The fact that "queue_ptr->queue[queue_ptr->wr_idx++]" could be somewhere in the object pointed by "queue_ptr" came to my mind too.</div>
<div dir="ltr">I also added this in the stackoverflow question at the bottom.</div>
<div dir="ltr">In such case, I assumed, that if I change the struct "queue_t" to have an array of "event_t" instead of just pointer to "event_t", like this:</div>
<div dir="ltr"> </div>
<div dir="ltr">
<pre class="lang-c prettyprint prettyprinted"><code><span class="kwd">typedef</span> <span class="kwd">struct</span>
<span class="pun">{</span>
    <span class="typ">event_t</span>                     <span class="typ">queue</span><span class="pun">[</span><span class="lit">256</span><span class="pun">];</span> <span class="com">// changed from pointer to array with max size</span>
    <span class="typ">size_t</span><span class="pln">                      size</span><span class="pun">;</span>
    <span class="typ">uint16_t</span><span class="pln">                    num_of_items</span><span class="pun">;</span>
    <span class="typ">uint8_t</span><span class="pln">                     rd_idx</span><span class="pun">;</span>
    <span class="typ">uint8_t</span><span class="pln">                     wr_idx</span><span class="pun">;</span>
<span class="pun">}</span> <span class="typ">queue_t</span><span class="pun">;</span></code><br /><br />there would be no valid way (without breaking the C standard definitions) that "queue_ptr->queue[queue_ptr->wr_idx++]" ends up somewhere inside "*queue_ptr", right?<br />However the generated assembly code still contained the same re-reads...<br />Any idea why would this happen even with the new "queue_t" struct definition?<br /><br />P.S.<br />I can easily reproduce it and provide any additional data which can be gathered during the compilation process, if it helps.<br /><br />Thanks,<br />Alex.</pre>
</div>
<div id="gtx-trans" style="position: absolute; left: 914px; top: 351px;"> </div></div>