SDCC cse incorrectly propagates constants over function calls when the constant is assigned to a variable that had its address taken:
c = 0xaa;
f();
d = c;
Will assign 0xaa to d, even when f() modifies the value of c via a pointer. For a complete example, see the regression test support/regression/tests/bug-2708.c. The bug can be repoduced by removing the preprocessor guard there.
Philipp
Since the iCode from dumpraw1 is correct, while dumpcse has hte bug, this looks like a CSE bug, the replacement happens in the ReplaceOpWithCheaperOp() call in line 2387 of SDCCcse.c.
Philipp
Last edit: Philipp Klaus Krause 2018-03-12
Fixed in [r10441]