From: <no...@so...> - 2002-05-26 18:03:59
|
Bugs item #560778, was opened at 2002-05-26 11:03 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=100599&aid=560778&group_id=599 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Donald Delmar Davis (ddd7) Assigned to: Nobody/Anonymous (nobody) Summary: Integers not initialized at all !!!!! Initial Comment: This is just to add some emphasis to previous report under "while loops". sdcc seems to forget about initializing integers. no warnings, no errors, no code generated for integer assignments. It's kind of a showstopper and takes a lot of confidence in the compiler away. --------begin c source snippet----- static unsigned char lcount,rcount, /*internal: time spaces to skip */ lrate,rrate, /*internal: step rate */ lphase,rphase, /*internal: current step phase */ ldir,rdir; /* direction */ static unsigned int lstg,rstg; /* steps to go */ ... other unrelated code ... main(){ /* * Initialize 8051 registers */ TMOD &= 0x0f; /* clear timer 1 control bits */ TMOD |= 0x20; /* set timer 1 to mode 2 */ //TL1 = 0xE8; TH1 = 0xE8; /* ~400 */ TL1 = 0x88; TH1 = 0x88; /* ~400 */ /* * Initialize variables for stepper movement */ rstg=0; lstg=300; rphase=0; lphase=0; rcount=0; lcount=0; rdir=0; ldir=0; rrate=0; lrate=0; ET1=1; /* enable timer 1 interupt */ EA=1; /* enable interupts */ TR1 = 1; /* start timer */ ---------------------- end c snippet. sdcc produces the following assembler. ---------------------- begin assembler snippet ;-------------------------------------------------------- ; File Created by SDCC : FreeWare ANSI-C Compiler ; Version 2.3.0 Sun May 26 09:20:44 2002 .... sfr defines ommitted. .... ;-------------------------------------------------------- ;-------------------------------------------------------- ; internal ram data ;-------------------------------------------------------- .area DSEG (DATA) _lcount: .ds 1 _rcount: .ds 1 _lrate: .ds 1 _rrate: .ds 1 _lphase: .ds 1 _rphase: .ds 1 _ldir: .ds 1 _rdir: .ds 1 _lstg: .ds 2 _rstg: .ds 2 .... code ommitted here .... ; ----------------------------------------- ; function main ; ----------------------------------------- _main: ; stepper.c 97 anl _TMOD,#0x0F ; stepper.c 98 orl _TMOD,#0x20 ; stepper.c 100 mov _TL1,#0x88 mov _TH1,#0x88 ; stepper.c 107 mov _rphase,#0x00 ; stepper.c 108 mov _lphase,#0x00 ; stepper.c 109 mov _rcount,#0x00 ; stepper.c 110 mov _lcount,#0x00 ; stepper.c 111 mov _rdir,#0x00 ; stepper.c 112 mov _ldir,#0x00 ; stepper.c 113 mov _rrate,#0x00 ; stepper.c 114 mov _lrate,#0x00 ; stepper.c 118 setb _ET1 ; stepper.c 119 setb _EA ; stepper.c 120 setb _TR1 ; stepper.c 135 ------------ end assembler snippet. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=100599&aid=560778&group_id=599 |