From: Joseph C. <jo...@jo...> - 2002-02-10 21:50:04
|
Hi, I suddenly started getting strange and noticed the following (I think) bug: sdcc (2.3.0, windos) reuses registers more than once to store local variables within a single function. The problem code snippet has the following local variable defined: void test_code (void) { unsigned int threshold; unsigned char count; unsigned int b; unsigned char ch; unsigned char sm; unsigned char prev; unsigned char i; int j; The .lst shows the following register allocations: ;------------------------------------------------------------ 268 ;Allocation info for local variables in function 'test_code' 269 ;------------------------------------------------------------ 270 ;threshold Allocated to in memory with name '_test_code_threshold_1_1' 271 ;count Allocated to registers r2 272 ;b Allocated to registers r5 r6 273 ;ch Allocated to registers r3 274 ;sm Allocated to registers r2 275 ;prev Allocated to registers 276 ;i Allocated to registers 277 ;j Allocated to in memory with name '_test_code_j_1_1' 278 ; setup.c 49 279 ; ----------------------------------------- 280 ; function test_code 281 ; ----------------------------------------- Whoooaaa. That ain't good. I've been trying to see if there's anything that I did on my side to tickle this behavior, but I don't see anything obvious. What's more troubling is that a number of these blank "allocated to registers" also reuse the same registers. The variable "i" is actually allocated to register r3 (according to the .lst). The variable "prev" is actually unused in my test code now. Am I doing something wrong? Or has anyone else seen this? Many thanks, Joseph |