From: SourceForge.net <no...@so...> - 2011-10-28 16:15:15
|
Bugs item #3429793, was opened at 2011-10-28 18:15 Message generated for change (Tracker Item Submitted) made by tsailer You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3429793&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Thomas Sailer (tsailer) Assigned to: Nobody/Anonymous (nobody) Summary: Reads of volatile variables sometimes optimized away Initial Comment: In the following code, the read of BLABLA is dropped: __xdata volatile unsigned char __at(0x1234) BLABLA; void doit(unsigned char n) { unsigned char i; for (i = 0; i < n; ++i) BLABLA; } I compiled using this command: sdcc -o x.rel -c -mmcs51 x.c When I change BLABLA; to (void)BLABLA; or to {BLABLA;}, or if I change the loop bound (n) to a constant, then the read is retained. Versions of SDCC tested: SDCC : mcs51/gbz80/z80/z180/r2k/ds390/pic16/pic14/TININative/ds400/hc08 3.0.6 #6993 (Oct 26 2011) (Linux) SDCC : mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 3.0.0 #6037 (Apr 13 2011) (Linux) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=3429793&group_id=599 |