From: Sanjiv K. G. N. <sa...@no...> - 2002-06-10 09:49:45
|
This could be fixed by a single line patch in SDCClrange.c as below. In function operandLUse() Ln 338 and Ln 346 if (OP_SYMBOL (op)->isreqv && !OP_SYMBOL (op)->_isparm && SPIL_LOC (op)) { SPIL_LOC (op)-> allocreq = 1; // Patch: werror (W_LOCAL_NOINIT, SPIL_LOC (op)->name, ic->filename, ic->lineno); } else { OP_SYMBOL (op)->allocreq = 1; // Patch: werror (W_LOCAL_NOINIT, OP_SYMBOL (op)->name, ic->filename, ic->lineno); } I don't know wheter it will cause performance overhead or incorrect results, but it works fine for me if I want to adjust the stack pointer inside genFunction(). Regards Sanjiv -----Original Message----- From: Sandeep Dutta [mailto:sa...@wi...] Sent: Sunday, June 09, 2002 8:59 PM To: Sanjiv Kumar Gupta, Noida; sdc...@li... Cc: sdc...@li... Subject: RE: [Sdcc-user] possible bug, stack allocation of uninitialized local variables. Hi Sanjiv, This is known problem. SDCC's live range analysis algorithm goes a little haywire if the locals are used before definition. Fixing this will cause massive performance problems. work around ... initialize local variables before use. Sandeep -----Original Message----- From: sdc...@li... [mailto:sdc...@li...]On Behalf Of Sanjiv Kumar Gupta, Noida Sent: Saturday, June 08, 2002 3:39 AM To: sdc...@li... Cc: sdc...@li... Subject: [Sdcc-user] possible bug, stack allocation of uninitialized local variables. Hi, for following snippet, void foo (unsigned char); main() { unsigned char i, j , k ; i = !j; i = i + k; foo (i); } The value of "sym->stack" inside genFunction() is not correct for --stack-auto. Thais value is 0 , but it should have been 2. The .dumprassgn file tells me that variable "i" is given a register and variables "j" and "k" are on stack. Regards Sanjiv _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink _______________________________________________ Sdcc-user mailing list Sdc...@li... https://lists.sourceforge.net/lists/listinfo/sdcc-user |