On 4/25/08, em3702 <[email protected]> wrote: > > > I compiled with -S and looked at the assembly. There is a jump instruction > on line 152 pointing to a label on line 519. That seems to be too much...
Right, so probably the distance to the jump target exceeds the range of the jump instruction which is from - 511 to +512 words, so depending on what code finds its way in-between lines 152 and 519 you may or may not get this error; note that this might depend on the optimization level. The compiler should of course deal with it on its own if it wasn't buggy, but as a practical workaround you might want to shorten the size of the basic blocks. For instance, instead of doing repetitive assignments like g_mgmt[a].data[MY_BUFFER_SIZE-8] = *((uint8_t*)&a_pData->sa+1); why don't you memcopy(g_mgmt[a].data,a_pData->sa,8)? The data direction is opposite to what you have, but it's just a convention, right? At some point I kind-of understood how does the toolchain deal with jump ranges, but I forgot---can anyone help? I do remember that it is tricky---it's possible to have loops like "if we use a long jump here, the code size increases and we must use a long jump there, so the code size increases further and forces a long jump elsewhere..."
