From: SourceForge.net <no...@so...> - 2006-12-10 16:47:25
|
Bugs item #1605880, was opened at 2006-11-30 01:36 Message generated for change (Settings changed) made by epetrich You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1605880&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: fixed >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Erik Petrich (epetrich) Assigned to: Erik Petrich (epetrich) Summary: Assignment optimized out of critical block Initial Comment: Since an update to a volatile variable is probably non-atomic, I've protected the assignment to it by enclosing the assignment within a __critical {} block. However, in some cases the assignment is optimized and moved to a point at which interrupts might still be enabled. volatile int x; void setx(int newx) { __critical { x=newx; } } _setx: ; genReceive mov _x,dpl mov (_x + 1),dph ; assignment moved here ; critical.c:9: } ; genCritical setb _test_sloc0_1_0 jbc ea,00103$ clr _test_sloc0_1_0 00103$: ; critical.c:8: x=newx; ; genEndCritical mov c,_test_sloc0_1_0 mov ea,c ; Peephole 300 removed redundant label 00101$ ret The above test code fails on SDCC #4492 for mcs51 (--model-small) and hc08, but not the z80. ---------------------------------------------------------------------- >Comment By: Erik Petrich (epetrich) Date: 2006-12-10 10:47 Message: Logged In: YES user_id=635249 Originator: YES Fixed in SDCC #4510 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1605880&group_id=599 |