Menu

#3075 Literal becomes volatile

closed-fixed
None
other
5
2020-07-02
2020-07-02
No

Compiling this code e.g. for pdk15 using latest sdcc

__sfr __at(0x15) c;

void f(void)
{
    c |= 0x04;
}

I see that the literal 0x04 changes type from const int to volatile unsigned char from the raw1 dump to the cse dump. Clearly there is some optimization to narrow it, which makes sense. But that optimization introduced an unecessary volatile, which prevents further optimizations.

Discussion

  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    Fixed in [r11706]. Code size went down a little bit in the existing regression tests, but I have no idea how we would create a test for this bug.

     

Log in to post a comment.