#185 volatile should not necessarily spoil loop reversal

open
nobody
None
5
2006-12-06
2006-12-06
No

/* Accessing a volatile variable within the loop
spoils loop reversal although the volatileness
is not related to the loop control variable

Would result in 7 versus 13 bytes for the
code below.

Seems to happen within isConformingBody()
(IS_VOLATILE (TETYPE (pbody))
in line 1800 in sdcc/sdcc/src/SDCCast.c)
*/

#if 1
volatile bit out_bit;
#else
bit out_bit;
#endif

void toggle(void)
{
unsigned char i;

for(i=0;i<8;i++)
out_bit = !out_bit;
}

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks